Image encoding device, image decoding device, image encoding method, image decoding method, image encoding program, and image decoding program

ABSTRACT

Variable-length encoder  16  feeds a CBP as an input symbol H 1  to variable-length code output part  30 . Coded symbol memory  31  supplies CBPs in neighboring blocks as coding map table reference information H 2  to coding map table provider  32 . Coding map table provider  32  determines a coding map table used in coding of the CBP, based on these CBPs in the neighboring blocks, and provides a coding map table H 4  to variable-length code output part  30 . Variable-length coding table provider  33  feeds a variable-length coding table H 5  to variable-length code output part  30 . Then the coding target CBP is subjected to variable-length coding, and the resultant is outputted as coded data D 9 . This allows information source coding of coding symbols to be performed efficiently according to the coding condition and the property of image.

TECHNICAL FIELD

The present invention relates to an image encoding apparatus, an imagedecoding apparatus, an image encoding method, an image decoding method,an image encoding program, and an image decoding program.

BACKGROUND ART

In recent years, systems for storage, reproduction, or transmission ofimage signals are becoming popular, including photo CD, video CD, DVDvideo (Digital Versatile Disk-Video), TV telephones, TV conferences,digital TV broadcasting, VOD (Video On Demand), and so on. In an imagetransmission system, as shown in FIG. 29A, on the transmitter side imageencoder 1 encodes an input image into a bit stream, and bit streamtransmitter 2 transmits the bit stream through a network to a receiver;on the receiver side bit stream receiver 3 receives the bit stream andimage decoder 4 decodes the received bit stream to output an image. Inan image storage system, as shown in FIG. 29B, image encoder 1 encodesan input image into a bit stream and the bit stream is stored in bitstream storage 5 such as a storage medium. In an image reproductionsystem, as shown in FIG. 29C, image decoder 4 decodes a bit streamstored in bit stream storage 5 and outputs a reproduced image.

In these systems there is a limit to a transmission band or to capacityof storage, and thus there are demands for effectively utilizing theseresources by use of an image encoding system with a compression rate ashigh as possible. The image encoding systems can be classified intostill picture encoding systems and moving picture encoding systems, anexample of which will be described below using the moving pictureencoding systems.

The conventionally known encoding systems for moving picture signalsinclude the International Video Coding Standards such as ITU-TRecommendation H.263, ISO/IEC International Standard 14496-2 (MPEG-4Visual), and so on.

In these moving picture encoding systems, generally, a motioncompensated interframe prediction is performed for a frame image forminga moving picture signal supplied as a coding target, with respect toanother frame image to reduce temporal redundancy in the moving picturesignal; orthogonal transform and quantization operations are carried outfor a difference image signal as a result of the interframe predictionor for an image signal not subjected to the interframe prediction toreduce spatial redundancy in the moving picture signal; and informationsource coding is further carried out for prediction and transform datasuch as obtained motion vector, orthogonal transform coefficients, andso on to reduce redundancy of data representation. These processeseliminate the redundancies in the moving picture signal, thus achievingefficient coding of moving picture.

In these moving picture encoding systems, the processes as describedabove are carried out for each of segments in a frame image, calledmacroblocks. In general one macroblock consists of 16 pixels×16 pixels,and a set of such macroblocks constitute a slice or a frame. On theother hand, one macroblock contains units of blocks resulting fromsubdivision thereof, and the aforementioned processes including themotion compensation, the orthogonal transform, etc. are carried out inunits of up to macroblocks and, if necessary, in units of smallerblocks.

FIG. 1 is a flowchart schematically showing an example of a movingpicture encoding method. This encoding method is an image encodingmethod of effecting predetermined transform and encoding operations onan input image D1 being a frame image in a moving picture or the like togenerate transmissible or storable, data-compressed, coded data D9 inthe image transmission system or in the image storage system.

In the image encoding method shown in FIG. 1, the data processingoperation is carried out in units of macroblocks obtained by dividingthe input image D1 into a predetermined size (a predetermined number ofpixels). First, the input image D1 is subjected to the predetermineddata processing operation to effect transformation of convert imagedata, thereby outputting a predictive residual image D5 expressed byspace coordinates, coding mode information D3 indicating informationabout the data processing operation, and motion vector information D2(step S101). The motion vector information D2 herein may contain, forexample, a value of a motion vector itself or a motion vector differencevalue being a difference between a motion vector in a target block and amotion vector in a neighboring block.

Specifically, with reference to a predetermined image region in a localdecoded image D12 described later, a search is made for an image arearesembling an image of the coding target macroblock (motion search), anda motion vector is determined by an amount of spatial movement of thecoding target macroblock relative to the image area resembling thecoding target macroblock, detected as a result of the search (motioncompensated prediction). Also generated as a predictive residual imageD5 is difference data of pixel values between the coding targetmacroblock and the image area resembling the image data of the codingtarget macroblock, detected as a result of the search. Then, based onthe motion vector and difference data of pixel values obtained as aresult of the motion search, a macroblock coding mode to be applied tothe image data is selected from a plurality of macroblock coding modesprepared.

The macroblock coding modes are generally classified under inter codingmodes using the motion compensation and intra coding modes not using themotion compensation. In the inter coding modes, the motion compensationis applied to a macroblock, and predictive residuals of pixel valuesobtained as a result thereof are outputted as a predictive residualimage D5. In the intra coding modes, predicted values of pixel values inthe macroblock are set to 0, whereby the input image D1 is directlyoutputted as a predictive residual image D5. Information indicating aselected coding mode and a quantization parameter is outputted as codingmode information D3, and information about the motion vector as motionvector information D2.

Then the predictive residual image D5 is subjected to an orthogonaltransform operation to generate a plurality of orthogonal transformcoefficients D6 which are image data expressed by space frequencies(frequency image data) (step S102). This orthogonal transform is carriedout for each of blocks resulting from subdivision of each macroblock, toyield orthogonal transform coefficients of each block.

The orthogonal transform coefficients are quantized by use of apredetermined quantization parameter to obtain quantized orthogonaltransform coefficients D7 (step S103).

In passing, the quantization of a certain block results in producing theorthogonal transform coefficients all being zero in the block. There isno need for performing the coding of information about orthogonaltransform coefficients for such an ineffective block with all theorthogonal transform coefficients of zero. Then the coding ofcoefficient information of an ineffective block is omitted by use ofcoded block pattern information (which will be referred to hereinafteras CBP representing Coded Block Pattern) indicating whether there is asignificant quantized orthogonal transform coefficient in the block,thereby increasing efficiency of coding.

There are also cases where the result of the quantization process isthat all the orthogonal transform coefficients are zero in all theblocks in a macroblock and each component of a motion vector is alsozero. For such an ineffective macroblock with all the orthogonaltransform coefficients of zero, there is no need for performing thecoding of information about the macroblock. Such ineffective macroblocksfrequently appear in stationary background portions and the like, andthus a macroblock coding flag (COD flag) is used for each macroblock todiscriminate whether the macroblock is effective or ineffective.

The CBP and the COD flag are outputted as coding supplementaryinformation D8.

Subsequently, variable-length coding and multiplexing operations arecarried out for the motion vector information D2, coding modeinformation D3, quantized orthogonal transform coefficients D7, andcoding supplementary information D8 to generate coded data D9 beingcompressed data (step S104).

Specifically, the variable-length coding using a variable-length codingtable is effected on each of coding symbols included in the motionvector information D2, coding mode information D3, quantized orthogonaltransform coefficients D7, and coding supplementary information D8 togenerate the coded data D9.

FIG. 2 is a block diagram showing an example of a configuration of animage encoding apparatus. The image encoding method shown in FIG. 1 willbe further described below with reference to the image encodingapparatus shown in FIG. 2.

With an input image D1 supplied as a coding target, first, a luma(luminance) signal image frame is divided into macroblocks of squareimage blocks in the size of 16 pixels×16 lines, and a chroma(color-difference) signal image frame into macroblocks of square imageblocks in the size of 8 pixels×8 lines. These macroblocks are imageblocks used as units of the data processing including the motioncompensation and others. In after-described DCT (an orthogonaltransform, e.g., in the MPEG-4 coding system, the blocks used are DCTblocks of the size of 8 pixels×8 lines. In this case, one macroblock hasfour luma (Y) blocks and two chroma (Cb, Cr) blocks in DCT. Image codingis carried out for each of these blocks.

The input image D1 is fed into a motion compensation means consisting ofmotion detector 11 and motion compensator 12. First, the input image D1is fed into motion detector 11 and a motion of image is detected foreach macroblock. The motion detector 11 compares image data of thecoding target macroblock with image data in an image region of the samesize as the macroblock, in a local decoded image to detect an image arearesembling the image of the coding target macroblock and generate amotion vector D2 indicating a motion of the image.

Specifically, the motion detector 11 searches for an image arearesembling the macroblock as a coding target in the input image D1, withreference to a predetermined image region in a local decoded image D12stored as a previously coded frame image in frame memory 20. Then motionvector information D2 is determined by an amount of spatial movementbetween the coding target macroblock and the image area resembling theimage data of the coding target macroblock, detected as a result of thesearch.

At this time, a coding mode applied to the coding target macroblock isalso selected out of a plurality of coding modes prepared in advance.FIGS. 3A-3C are schematic diagrams showing an example of the codingmodes prepared for the motion compensation. The coding mode exemplifiedin FIG. 3A is an inter coding mode 0, the coding mode in FIG. 3B aninter coding mode 1, and the coding mode in FIG. 3C an intra coding mode2.

The inter coding modes 0-1 are modes of carrying out interframe coding,using mutually different block segmentation ways into motioncompensation blocks. Concerning the motion compensation blocks in eachmode, as shown in FIG. 3A, the inter coding mode 0 uses one block in thesize of 16 pixels×16 lines for a luma component image. As shown in FIG.3B, the inter coding mode 1 uses four blocks in the size of 8 pixels×8lines for a luma component image.

The aforementioned motion vector information D2 is given to each motioncompensation block segmented in the selected inter coding mode.Therefore, each macroblock is given the motion vector information D2 bythe number of segment blocks. The motion vector information D2 isassigned to each motion compensation block, for example, according tothe order indicated by numbers in each coding mode in FIGS. 3A-3C. Inthe both inter coding modes, a block in the size of 8 pixels×8 lines isused for a chroma component image, and a motion vector assigned theretois one in a length equal to a half of a motion vector for a lumacomponent image.

An example of the coding mode selecting method is as follows: forexample, a variance value is first determined of pixel values in apredictive residual image after the motion compensation in a macroblock;where the variance value is larger than a preset threshold or largerthan a variance value of pixel values in the macroblock in the inputimage, the intra coding mode is selected; the inter coding mode isselected in the other cases. This means that the intra coding mode isselected where the image data of the macroblock is complex.

When the inter coding mode is selected, the motion search is carried outfor each of the four segment blocks of a macroblock to generate motionvectors and difference values of image data corresponding to therespective blocks. Then calculated are a code amount M(MV) for onemotion vector in the inter coding mode 0 and a total M(4MV) of codeamounts for four motion vectors in the inter coding mode 1. Furthercalculated are difference values D(MV) of image data in the inter codingmode 0 and a total D(4MV) of difference values of image data in theinter coding mode 1. Then, using a preset coefficient α, a comparison ismade between values of M(MV)+α·D(MV) and M(4MV)+α·D(4MV); for example,when the former is smaller than or equal to the latter, the inter codingmode 0 is selected; when the latter is smaller, the inter coding mode 1is selected.

Where the coding mode is the inter coding mode, after a motion vector isobtained for each motion compensation block, motion compensator 12generates a predicted image D4, using the motion vector information D2from motion detector 11 and the local decoded image D12 from framememory 20. Subsequently, subtracter 13 calculates the difference(predictive residual) between input image D1 and predicted image. D4 togenerate a predictive residual image D5.

Where the coding mode is the intra coding mode, the pixel data ofpredicted image D4 is set to 0, whereby the input image D1 is directlyoutputted as a predictive residual image D5.

The information indicating the selected coding mode, and thequantization parameter are outputted as coding mode information D3, andthe information about the motion vector as motion vector information D2.

The image data of predictive residual image D5 is fed into orthogonaltransform part (orthogonal transform means) 14. The orthogonal transformpart 14 performs the orthogonal transform for each orthogonal transformblock included in a macroblock of the predictive residual image D5, togenerate orthogonal transform coefficients D6 being frequency imagedata. For example, in MPEG-4, a macroblock includes four blocks of thesize of 8 pixels×8 lines for each luma component image, and a macroblockincludes one orthogonal transform block of the size of 8 pixels×8 linesfor each chroma component image.

FIGS. 4A and 4B are diagrams showing the orthogonal transform of imagedata. Image data of each block resulting from the division for theorthogonal transform, in the predictive residual image D5 is space imagedata and, as exemplified by image components of 8 pixels×8 lines in FIG.4A, it is represented by space image components a₁₁-a₈₈ of 8 pixels×8lines defined by horizontal coordinates and vertical coordinates. Theorthogonal transform part 14 performs the orthogonal transform of thisspace image data by a predetermined transformation method to transformit into frequency image data as shown in FIG. 4B. This frequency imagedata is represented by orthogonal transform coefficients f₁₁-f₈₈ beingfrequency image components of 8 pixels×8 lines defined by horizontalfrequencies and vertical frequencies.

A specific orthogonal transform applicable herein is, for example, theDiscrete Cosine Transform (DCT). The DCT is an orthogonal transformusing the cosine terms of the Fourier transform and is often used inimage coding. The DCT over the space image data generates the DCTcoefficients f₁₁-f₈₈ being frequency image data. In the DCT, forexample, in the MPEG-4 coding system, DCT blocks of 8 pixels×8 lines asshown in FIGS. 4A, 4B are used as blocks for the orthogonal transform.

Quantizer 15 quantizes the orthogonal transform coefficients D6generated in this way, by a predetermined quantization parameter toyield quantized orthogonal transform coefficients D7. The quantizer alsogenerates CBPs indicating whether there is a significant orthogonaltransform coefficient, in units of blocks and, a COD flag indicatingwhether a macroblock contains a significant orthogonal transformcoefficient, and outputs them as coding supplementary information D8.

The quantized orthogonal transform coefficients D7 and codingsupplementary information D8 generated by quantizer 15 are subjected tovariable-length coding at variable-length encoder 16, which generatescoded data D9 being compressed data of the input image D1. Thevariable-length encoder 16 further receives input of the motion vectorinformation D2 detected by the motion detector 11 and the coding modeinformation D3 indicating the coding mode selected at motion detector11, and the quantization parameter. These motion vector information D2and coding mode information D3 are also subjected to the variable-lengthcoding at variable-length encoder 16, and the resultant data ismultiplexed over the coded data D9.

In the present image encoding apparatus, the quantized orthogonaltransform coefficients D7 generated at quantizer 15 are dequantized bydequantizer 17 to yield dequantized orthogonal transform coefficientsD10, and they are further subjected to an inverse orthogonal transformat inverse orthogonal transform part 18 to yield a local decodedresidual image D11. Then the local decoded residual image D11 and thepredicted image D4 are added at adder 19 to generate a local decodedimage D12. This local decoded image D12 is stored into frame memory 20to be utilized for the motion compensation of another frame image.

An example of a moving picture decoding method and moving picturedecoding apparatus will be described below.

FIG. 5 is a flowchart schematically showing an example of an imagedecoding method. The present decoding method is an image decoding methodof effecting predetermined decoding and transformation operations oncoded data D9 generated by the image encoding method shown in FIG. 1, torestore a decoded image D12 as an image identical to the local decodedimage D12.

In the image decoding method shown in FIG. 5, first, the coded data D9is subjected to variable-length decoding using a variable-lengthdecoding table to generate quantized orthogonal transform coefficientsD7 (step S201). The motion vector information D2, coding modeinformation D3, and coding supplementary information D8 are alsovariable-length decoded similarly from the coded data D9 by use of thevariable-length decoding table.

Specifically, a variable-length decoding table is first set as a tableto be applied to the coded data D9, and the coded data isvariable-length decoded by use of the variable-length decoding table togenerate coding symbols of the respective information items.

Then the quantized orthogonal transform coefficients D7 are subjected toa dequantization operation to generate dequantized orthogonal transformcoefficients D10 (step S202) and an inverse orthogonal transformoperation is further carried out to generate a local decoded residualimage D11 (step S203). Then, using the local decoded residual image D11and a previously decoded frame, the motion compensation is carried outby applying a coding mode indicated by the coding mode information D3,to restore the decoded image D12 (S204).

FIG. 6 is a block diagram schematically showing a configuration of anexample of a moving picture decoding apparatus.

Coded data D9 supplied as a decoding target is fed into variable-lengthdecoder 21 which performs the variable-length decoding using apredetermined variable-length decoding table to generate decodingsymbols of the motion vector information D2, coding mode information D3,quantized orthogonal transform coefficients D7, and coding supplementaryinformation D8. Specifically, for data-compressed coded data D9, thevariable-length decoder 21 retrieves each data included for eachmacroblock in the coded data D9, from a bit stream while starting fromthe head of the frame image, and it variable-length decodes the data togenerate the motion vector information D2, coding mode information D3,quantized orthogonal transform coefficients D7, and coding supplementaryinformation D8. The variable-length decoding table used for thevariable-length decoding is switched to another according to each symbolas occasion demands, as described above.

The quantized orthogonal transform coefficients D7 are subjected todequantization and inverse orthogonal transform at dequantizer 22 andinverse orthogonal transformer 23. This results in generating a localdecoded residual image D11. This local decoded residual image D11 is animage corresponding to the predictive residual image D5 before thecoding, but some information is lost through the quantization anddequantization processes.

On the other hand, the motion vector information D2 and coding modeinformation D3 is fed into motion compensator 24. The motion compensator24 performs the motion compensation for the image by the coding modeindicated by the coding mode information D3 to generate a predictedimage D4, using the motion vector information D2 from thevariable-length decoder 21 and a decoded image stored in frame memory25. Then adder 26 adds the local decoded residual image D11 and thepredicted image D4 to output a recovered frame image as a decoded imageD12.

DISCLOSURE OF THE INVENTION

In the conventional, common moving-picture coding systems, as describedabove, the coded block pattern information (CBP) indicating whethersignificant image data is present was transmitted for each predeterminedblock in a macroblock, so as to permit omission of transmission of imagedata in units of blocks, thereby increasing the efficiency of coding.The coded block pattern information was provided using different entropycodes between luma signals and chroma signals to apply more suitableentropy codes according to characteristics of the respective signals,thereby increasing the efficiency of coding.

The coded block pattern information indicating significant image data ineach block can be said to indicate likelihood of occurrence ofsignificant image data in the macroblock, or an appearance pattern ineach block with significant image data. Such information largely differsin its property, depending upon the coding condition and the property ofimage, even among signals of the same kind, luma signals or chromasignals.

For example, the moving picture coding involves the quantization oforthogonal transform coefficients by the quantization parameter and, inthat process, a transaction of decreasing the quantity of image data iscarried out by setting 0 for orthogonal transform coefficients of smallvalues with little effect on the quality of decoded image so as to omitthem.

At this time, where the quantization parameter takes a large value,coarser quantization is made, so as to omit many orthogonal transformcoefficients assigned 0, thereby decreasing the number of blocks withsignificant image data. At this time, efficient coding can be performedby information source coding to assign codes of short code lengths tothe coded block pattern information for few blocks with significantimage data.

Where the quantization parameter takes a small value on the other hand,finer quantization is made, so as to decrease the number of orthogonaltransform coefficients assigned 0 to be omitted, so that there are manyblocks with significant image data. In this case, efficient coding canbe performed by information source coding to assign codes of longer codelengths to the coded block pattern information for many blocks withsignificant image data.

For example, in the moving picture coding, the processing of motioncompensated interframe predictive coding tends to make an unsuccessfulprediction and provide large signals of difference image in an areawhere the motion is significant and complex on an image, whereas ittends to make a successful prediction and provide small signals ofdifference image in an area where the motion is small and simple on theimage.

At this time, there are many blocks with significant image data in thecase of the large signals of difference image, while there are fewblocks with significant image data in the case of the small signals ofdifference image. If the coded block pattern information is coded by oneinformation source coding means even in those cases, it will bedifficult to achieve efficient coding in the both cases.

Concerning the motion vector, it is common practice to performinformation source coding of a difference motion vector, which is adifference between a predicted motion vector resulting from a predictionof a motion vector value in a block as a target for coding from valuesof motion vectors in neighboring blocks, and an actual motion vector.The magnitudes of difference motion vectors tend to converge on 0 in thecase where the motion is monotonic in neighboring images, whereas themagnitudes of difference motion vectors tend not to converge on 0 in thecase where the motion is intense in neighboring images. In such cases,therefore, if the difference motion vectors are coded by one informationsource coding means, it will also be difficult to achieve efficientcoding in the both cases.

As for the coding modes of macroblocks, characteristics of probabilitydistribution of occurring coding modes are significantly differentbetween in cases where the motion and texture are complex in neighboringimages and in cases where they are monotonic, and thus, if the codingmodes are encoded by one information source coding means, it will alsobe difficult to achieve efficient coding in the both cases.

Concerning the quantized orthogonal transform coefficients,characteristics of distribution of coefficients occurring in the blockare also significantly different, depending upon the coding conditionand the property of image. For example, where the quantization parametertakes a small value, finer quantization is made, and thus more quantizedorthogonal transform coefficients of large values tend to occur; wherethe quantization parameter takes a large value, quantized orthogonaltransform coefficients of small values tend to occur readily. In thesecases, if the quantized orthogonal transform coefficients are encoded byone information source coding means, it will also be difficult toachieve efficient coding in the both cases.

The quantized orthogonal transform coefficients will be described belowin more detail. In the conventional, common image coding systems, asdescribed above, the quantized orthogonal transform coefficients werefurther subjected to the variable-length coding or information sourcecoding, so as to decrease the volume of information necessary fortransmission of the orthogonal transform coefficients, therebyincreasing the efficiency of coding.

Concerning the orthogonal transform coefficients, the property of whatkind of information tends to occur varies depending upon the property ofimage. For example, depending upon whether the intra coding mode or theinter coding mode is applied in the moving picture coding, the imagesubject to the orthogonal transform differs, either the image itself orthe residual image after the motion compensation, so that the propertyof the orthogonal transform coefficients can significantly differ aswell. For this reason, the common moving picture coding systems areconfigured to prepare dedicated variable-length coding tables for theorthogonal transform coefficients in the respective coding modes, so asto implement the information source coding suitable for the propertiesof the orthogonal transform coefficients in the respective modes.

However, the orthogonal transform coefficients change their property ofwhat kind of information tends to occur, also depending upon situationsof the orthogonal transform coefficients themselves to be encoded.

The orthogonal transform coefficients are those obtained as a result ofa transformation to transform image signals into discrete signals in thespatial frequency domain by an orthogonal transform. Therefore, anatural image has a high correlation between adjacent pixels andprovides stronger signals in the low spatial frequency domain, and thusthe orthogonal transform coefficients resulting from the orthogonaltransform generally have such characteristics that large coefficientvalues are likely to appear densely in the low frequency domain, whilein the high frequency domain nonzero coefficient values are unlikely tooccur and rarely take large values. Furthermore, in the common imagecoding systems, the aforementioned quantization involves a transactionof zeroing the orthogonal transform coefficients of small values in thehigh frequency domain. This is the transaction to increase the codingefficiency by decreasing signals with less effect on the human vision,but this transaction enhances the tendency that coefficient values areunlikely to appear in the high frequency domain.

The orthogonal transform coefficients are not completely off thecorrelation as to occurrence of each coefficient in natural images; forexample, where image signals contain signals with large pixel values,many coefficients orthogonally transformed therefrom will take largevalues. Conversely, if two orthogonal transform coefficients belong totheir respective frequency regions apart from each other, thecorrelation will be low between the coefficients, while also affected bythe aforementioned difference in property depending upon the frequencydomains.

While the orthogonal transform coefficients largely vary their propertydepending upon the frequency regions to which they belong, the commonimage coding systems adopt the uniform information source coding inspite of the change of the property thereof, which posed the problemthat the efficient information source coding was not achieved.

As described above, the conventional moving picture coding had theproblem that the information source coding was not efficientlyperformed, because the property of the coding-related information varieddepending upon the coding condition and the property of image.

The present invention has been accomplished in order to solve theproblems described above, and an object of the present invention is toprovide an image encoding apparatus, an image decoding apparatus, animage encoding method, an image decoding method, an image encodingprogram, and an image decoding program capable of efficiently performingthe information source coding of the coding-related informationaccording to the coding condition and the property of image.

In order to achieve the above object, an image encoding apparatus of thepresent invention is an image encoding apparatus comprising: a motiondetection part for dividing a coding target image into macroblocks of apredetermined size, dividing each said macroblock into blocks of apredetermined shape and size specified based on a macroblock type, andperforming a motion compensated prediction in each unit of said block tooutput a motion vector; a motion compensation part for generating apredicted image from a reference image on the basis of the motion vectoroutputted from the motion detection part; a subtraction part forcalculating a difference between the predicted image generated by themotion compensation part, and the coding target image to output apredictive residual image; a transform part for performing transformcoding of the predictive residual image outputted from the subtractionpart, in each unit of a predetermined transform block to outputtransform coefficients; a quantization part for quantizing the transformcoefficients outputted from the transform part, based on a quantizationparameter, to output quantized transform coefficients; and an encodingpart for performing compression coding of coding-related informationcontaining the motion vector outputted from the motion detection part,the macroblock type, the quantization parameter, and the quantizedtransform coefficients outputted from the quantization part, to outputcoded data; wherein the encoding part comprises a coded symbol memoryfor memorizing the coding-related information; a coding procedureprovider for providing one or more types of coding procedures; and acoded data outputting part for selecting one of the coding proceduresprovided by the coding procedure provider, based on a predeterminedcoding procedure selection criterion, using the coding-relatedinformation stored in the coded symbol memory, and for performing thecompression coding of the coding-related information on the basis of theselected coding procedure to output the coded data.

An image decoding apparatus corresponding thereto is an image decodingapparatus comprising a decoding part for decoding coded data obtained bydividing a coding target image into macroblocks of a predetermined size,dividing each said macroblock into blocks of a predetermined shape andsize specified based on a macroblock type, performing a motioncompensated prediction in each unit of said block to output a motionvector, generating a predicted image from a reference image on the basisof the motion vector, calculating a difference between the predictedimage and the coding target image to output a predictive image,performing transform coding of the predictive residual image in eachunit of a predetermined transform block to output transformcoefficients, quantizing the transform coefficients on the basis of aquantization parameter to output quantized transform coefficients, andperforming compression coding of coding-related information containingthe motion vector, the quantized transform coefficients, the macroblocktype, and the quantization parameter to yield coded data, wherein thedecoding part comprises a decoded symbol memory for memorizing thecoding-related information previously decoded; a decoding procedureprovider for providing one or more types of decoding procedures; and adecoded data outputting part for selecting a decoding procedure which isone of the decoding procedures provided by the decoding procedureprovider and which corresponds to a coding procedure used in the codingof the coding-related information as a decoding target, based on apredetermined decoding procedure selection criterion, using thecoding-related information previously decoded and stored in the decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure to output decoded data.

In order to achieve the above object, an image encoding method of thepresent invention is an image encoding method comprising: a motiondetection step of dividing a coding target image into macroblocks of apredetermined size, dividing each said macroblock into blocks of apredetermined shape and size specified based on a macroblock type, andperforming a motion compensated prediction in each unit of said block tooutput a motion vector; a motion compensation step of generating apredicted image from a reference image on the basis of the motion vectoroutputted in the motion detection step; a subtraction step ofcalculating a difference between the predicted image generated in themotion compensation step, and the coding target image to output apredictive residual image; a transform step of performing transformcoding of the predictive residual image outputted in the subtractionstep, in each unit of a predetermined transform block to outputtransform coefficients; a quantization step of quantizing the transformcoefficients outputted in the transform step, based on a quantizationparameter, to output quantized transform coefficients; and an encodingstep of performing compression coding of coding-related informationcontaining the motion vector outputted in the motion detection step, themacroblock type, the quantization parameter, and the quantized transformcoefficients outputted in the quantization step, to output coded data;wherein the encoding step is to prepare one or more types of codingprocedures, select a coding procedure out of the one or more types ofcoding procedures, based on a predetermined coding procedure selectioncriterion, using the coding-related information stored in a coded symbolmemory, and perform the compression coding of the coding-relatedinformation on the basis of the selected coding procedure to output thecoded data.

An image decoding method corresponding thereto is an image decodingmethod comprising a decoding step of decoding coded data obtained bydividing a coding target image into macroblocks of a predetermined size,dividing each said macroblock into blocks of a predetermined shape andsize specified based on a macroblock type, performing a motioncompensated prediction in each unit of said block to output a motionvector, generating a predicted image from a reference image on the basisof the motion vector, calculating a difference between the predictedimage and the coding target image to output a predictive image,performing transform coding of the predictive residual image in eachunit of a predetermined transform block to output transformcoefficients, quantizing the transform coefficients on the basis of aquantization parameter to output quantized transform coefficients, andperforming compression coding of coding-related information containingthe motion vector, the quantized transform coefficients, the macroblocktype, and the quantization parameter to yield coded data, wherein thedecoding step is to prepare one or more types of decoding procedures,select a decoding procedure which is one of said one or more types ofdecoding procedures and which corresponds to a coding procedure used inthe coding of the coding-related information as a decoding target, basedon a predetermined decoding procedure selection criterion, using thecoding-related information previously decoded and stored in a decodedsymbol memory, and decode the coding-related information on the basis ofthe selected decoding procedure to output decoded data.

In order to achieve the above object, an image encoding program of thepresent invention is an image encoding program for letting a computerfunction as: motion detection means for dividing a coding target imageinto macroblocks of a predetermined size, dividing each said macroblockinto blocks of a predetermined shape and size specified based on amacroblock type, and performing a motion compensated prediction in eachunit of said block to output a motion vector; motion compensation meansfor generating a predicted image from a reference image on the basis ofthe motion vector outputted from the motion detection means; subtractionmeans for calculating a difference between the predicted image generatedby the motion compensation means, and the coding target image to outputa predictive residual image; transform means for performing transformcoding of the predictive residual image outputted from the subtractionmeans, in each unit of a predetermined transform block to outputtransform coefficients; quantization means for quantizing the transformcoefficients outputted from the transform means, based on a quantizationparameter, to output quantized transform coefficients; and encodingmeans for performing compression coding of coding-related informationcontaining the motion vector outputted from the motion detection means,the macroblock type, the quantization parameter, and the quantizedtransform coefficients outputted from the quantization means, to outputcoded data; wherein the encoding means comprises coding procedureproviding means for providing one or more types of coding procedures;and coded data outputting means for selecting one of the codingprocedures provided by the coding procedure providing means, based on apredetermined coding procedure selection criterion, using thecoding-related information stored in a coded symbol memory, and forperforming the compression coding of the coding-related information onthe basis of the selected coding procedure to output the coded data.

An image decoding program corresponding thereto is an image decodingprogram for letting a computer function as: decoding means for decodingcoded data obtained by dividing a coding target image into macroblocksof a predetermined size, dividing each said macroblock into blocks of apredetermined shape and size specified based on a macroblock type,performing a motion compensated prediction in each unit of said block tooutput a motion vector, generating a predicted image from a referenceimage on the basis of the motion vector, calculating a differencebetween the predicted image and the coding target image to output apredictive image, performing transform coding of the predictive residualimage in each unit of a predetermined transform block to outputtransform coefficients, quantizing the transform coefficients on thebasis of a quantization parameter to output quantized transformcoefficients, and performing compression coding of coding-relatedinformation containing the motion vector, the quantized transformcoefficients, the macroblock type, and the quantization parameter toyield coded data, wherein the decoding means comprises a decodingprocedure providing means for providing one or more types of decodingprocedures; and decoded data outputting means for selecting a decodingprocedure which is one of the decoding procedures provided by thedecoding procedure providing means and which corresponds to a codingprocedure used in the coding of the coding-related information as adecoding target, based on a predetermined decoding procedure selectioncriterion, using the coding-related information previously decoded andstored in a decoded symbol memory, and for decoding the coding-relatedinformation on the basis of the selected decoding procedure to outputdecoded data.

The above-described image encoding apparatus, image encoding method, andimage encoding program are configured to prepare a plurality ofprocedures for performing the information source coding of onecoding-related information and select a procedure to be used in theinformation source coding of the coding-related information in a block,out of these procedures. Therefore, the procedure to be used in theinformation source coding, which is suitable for the property of eachcoding symbol varying as described above, can be selected from theplurality of procedures. As a result, it becomes feasible to efficientlyperform the information source coding of the coding symbol, according tothe coding condition and the property of image.

The above-described image decoding apparatus, image decoding method, andimage decoding program are configured to prepare a plurality ofprocedures for information source decoding of one coding-relatedinformation and select a procedure to be used in the information sourcedecoding of the coding-related information in a block, out of theseprocedures. Therefore, it is feasible to correctly decode the coded datacoded by the aforementioned image encoding apparatus, image encodingmethod, and image encoding program.

The image encoding apparatus of the present invention can also beconfigured so that the encoding part has a function of performingcompression coding of coded block pattern information containing anonzero coefficient existence flag indicating whether there exists anonzero, said quantized transform coefficient, for each said transformblock in a said macroblock, and so that, on the occasion of encoding thecoded block pattern information in the coding target macroblock, thecoding procedure provider provides a coding procedure of decreasing acode length as a spatial correlation of the coded block patterninformation becomes higher between the coding target macroblock and aneighboring macroblock thereto.

In the image decoding apparatus corresponding thereto, the decoding parthas a function of, for each of the transform blocks in a saidmacroblock, decoding coded block pattern information containing anonzero coefficient existence flag indicating whether there exists anonzero, said quantized transform coefficient, and, on the occasion ofdecoding the coded block pattern information in the coding targetmacroblock, the decoding procedure provider provides a decodingprocedure corresponding to a coding procedure provided so as to decreasea code length as a spatial correlation of the coded block patterninformation becomes higher between the coding target macroblock and aneighboring macroblock thereto.

The image encoding apparatus of the present invention can also beconfigured so that, where a macroblock type in a neighboring macroblockto the coding target macroblock is one indicating division of the codingtarget macroblock into a maximum number of blocks, the coding procedureprovider assumes that all the coding blocks in the coding targetmacroblock have the coded block pattern information indicating inclusionof a nonzero quantized transform coefficient, and, on the occasion ofencoding the coded block pattern information in the coding targetmacroblock, the coding procedure provider provides a coding procedure ofdecreasing a code length as a spatial correlation of the coded blockpattern information becomes higher between the coding target macroblockand the neighboring macroblock thereto.

In the image decoding apparatus corresponding thereto, where amacroblock type in a neighboring macroblock to the coding targetmacroblock is one indicating division of the coding target macroblockinto a maximum number of blocks, the decoding procedure provider assumesthat all the coding blocks in the coding target macroblock have thecoded block pattern information indicating inclusion of a nonzeroquantized transform coefficient, and, on the occasion of decoding thecoded block pattern information in the coding target macroblock, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to decrease a code length as aspatial correlation of the coded block pattern information becomeshigher between the coding target macroblock and the neighboringmacroblock thereto.

Furthermore, the image encoding apparatus of the present invention canalso be configured so that, on the occasion of encoding the coded blockpattern information in the coding target macroblock, where a size of thequantization parameter in the coding target macroblock is greater than apreset threshold, the coding procedure provider provides a codingprocedure of setting a shorter code length for the coded block patterninformation indicating a smaller number of blocks containing a nonzeroquantized transform coefficient.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the coded block pattern information in the coding targetmacroblock, where a size of the quantization parameter in the codingtarget macroblock is larger than a preset threshold, the decodingprocedure provider provides a decoding procedure corresponding to acoding procedure provided so as to set a shorter code length for thecoded block pattern information indicating a smaller number of blocksincluding a nonzero quantized transform coefficient.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the coded block patterninformation in the coding target macroblock, the coding procedureprovider provides a coding procedure of setting a smaller deviation ofcode lengths with increase in the number of blocks in a neighboringmacroblock to the coding target macroblock.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the coded block pattern information in the coding targetmacroblock, the decoding procedure provider provides a decodingprocedure corresponding to a coding procedure provided so as to set asmaller deviation of code lengths with increase in the number of blocksin a neighboring macroblock to the coding target macroblock.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the quantized transformcoefficients in the coding target macroblock, the coding procedureprovider provides a coding procedure of setting a smaller deviation ofcode lengths with increase in absolute values of the quantized transformcoefficients in a neighboring macroblock to the coding targetmacroblock.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the quantized transform coefficients in the coding targetmacroblock, the decoding procedure provider provides a decodingprocedure corresponding to a coding procedure provided so as to set asmaller deviation of code lengths with increase in absolute values ofthe quantized transform coefficients in a neighboring macroblock to thecoding target macroblock.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the macroblock type inthe coding target macroblock, the coding procedure provider provides acoding procedure of decreasing a code length as a spatial correlation ofthe macroblock type becomes higher between the coding target macroblockand a neighboring macroblock thereto.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the macroblock type in the coding target macroblock, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to decrease a code length as aspatial correlation of the macroblock type becomes higher between thecoding target macroblock and a neighboring macroblock thereto.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the macroblock type inthe coding target macroblock, the coding procedure provider provides acoding procedure of setting a shorter code length for a macroblock typeincluding a larger number of blocks.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the macroblock type in the coding target macroblock, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to set a shorter code length for amacroblock type including a larger number of blocks.

The image encoding apparatus of the present invention can also beconfigured so that the encoding part has a function of encoding a numberof said nonzero quantized transform coefficients in the block, and sothat, on the occasion of encoding the number of said nonzero quantizedtransform coefficients in the coding target macroblock, where the numberof said nonzero quantized transform coefficients in a neighboring blockto the coding target block is smaller than a preset threshold, thecoding procedure provider provides a coding procedure of decreasing acode length with decrease in the number of said nonzero quantizedtransform coefficients.

In the image decoding apparatus corresponding thereto, the decoding parthas a function of decoding a number of said nonzero quantized transformcoefficients in the block, and, on the occasion of decoding the numberof said nonzero quantized transform coefficients in the coding targetmacroblock, where the number of said nonzero quantized transformcoefficients in a neighboring block to the coding target block issmaller than a preset threshold, the decoding procedure providerprovides a decoding procedure corresponding to a coding procedureprovided so as to decrease a code length with decrease in the number ofsaid nonzero quantized transform coefficients.

The image encoding apparatus of the present invention can also beconfigured so that the coded symbol memory has a function of holding adifference motion vector value being a difference between a predictedmotion vector predicted from a neighboring block, and an actual motionvector, and so that, on the occasion of encoding the coded block patterninformation in the coding target macroblock, where a magnitude of thedifference motion vector value in a neighboring macroblock to the codingtarget macroblock is larger than a preset threshold, the codingprocedure provider provides a coding procedure of setting a shorter codelength for coded block pattern information indicating a larger number ofblocks containing a nonzero quantized transform coefficient.

In the image decoding apparatus corresponding thereto, the decodedsymbol memory has a function of holding a difference motion vector valuebeing a difference between a predicted motion vector predicted from aneighboring block, and an actual motion vector, and, on the occasion ofdecoding the coded block pattern information in the coding targetmacroblock, where a magnitude of the difference motion vector value in aneighboring macroblock to the coding target macroblock is larger than apreset threshold, the decoding procedure provider provides a decodingprocedure corresponding to a coding procedure provided so as to set ashorter code length for coded block pattern information indicating alarger number of blocks containing a nonzero quantized transformcoefficient.

The image encoding apparatus of the present invention can also beconfigured so that the coded symbol memory has a function of holding adifference motion vector value being a difference between a predictedmotion vector predicted from a neighboring block, and an actual motionvector, and so that, on the occasion of encoding the difference motionvector value in the coding target macroblock, where a magnitude of thedifference motion vector value in a neighboring block to the codingtarget block is smaller than a preset threshold, the coding procedureprovider provides a coding procedure of setting a shorter code lengthfor a smaller difference motion vector value.

In the image decoding apparatus corresponding thereto, the decodedsymbol memory has a function of holding a difference motion vector valuebeing a difference between a predicted motion vector predicted from aneighboring block, and an actual motion vector, and, on the occasion ofdecoding the difference motion vector value in the coding targetmacroblock, where a magnitude of the difference motion vector value in aneighboring block to the coding target block is smaller than a presetthreshold, the decoding procedure provider provides a decoding procedurecorresponding to a coding procedure provided so as to set a shorter codelength for a smaller difference motion vector value.

The image encoding apparatus of the present invention can also beconfigured so that the coded symbol memory has a function of holding adifference motion vector value being a difference between a predictedmotion vector predicted from a neighboring block, and an actual motionvector, and so that, on the occasion of encoding the macroblock type inthe coding target macroblock, where a magnitude of the difference motionvector value in a neighboring block to the coding target block is largerthan a preset threshold, the coding procedure provider provides a codingprocedure of setting a shorter code length for a macroblock typeincluding a larger number of blocks.

In the image decoding apparatus corresponding thereto, the decodedsymbol memory has a function of holding a difference motion vector valuebeing a difference between a predicted motion vector predicted from aneighboring block, and an actual motion vector, and, on the occasion ofdecoding the macroblock type in the coding target macroblock, where amagnitude of the difference motion vector value in a neighboring blockto the coding target block is larger than a preset threshold, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to set a shorter code length for amacroblock type including a larger number of blocks.

In order to achieve the above object, another image encoding apparatusof the present invention is an image encoding apparatus comprising: atransform part for dividing a coding target image or a predictiveresidual image generated based on the coding target image, intopredetermined transform blocks, and for performing transform coding ofthe coding target image or the predictive residual image in each unit ofsaid transform block to output transform coefficients; a quantizationpart for quantizing the transform coefficients outputted from thetransform part, based on a quantization parameter, to output quantizedtransform coefficients; and an encoding part for performing compressioncoding of coding-related information containing the quantizationparameter and the quantized transform coefficients outputted from thequantization part, to output coded data; wherein the encoding part has afunction of converting the quantized transform coefficients in thecoding target block to a one-dimensional string according to frequenciesand encoding a zero run value being a number of consecutive coefficientsproviding 0 as an absolute value of the quantized transform coefficientsin the one-dimensional string, a level value being an absolute value ofa said quantized transform coefficient, and a positive/negative signindicating whether the quantized transform coefficient is positive ornegative, and comprises a coded symbol memory for memorizing thecoding-related information; a coding procedure provider for providingone or more types of coding procedures; and a coded data outputting partfor selecting one of the coding procedures provided by the codingprocedure provider, based on a predetermined coding procedure selectioncriterion, using the coding-related information stored in the codedsymbol memory, and for performing the compression coding of thecoding-related information on the basis of the selected coding procedureto output the coded data.

Another image decoding apparatus corresponding thereto is an imagedecoding apparatus comprising: a decoding part for decoding coded dataobtained by dividing a coding target image or a predictive residualimage generated based on the coding target image, into predeterminedtransform blocks, performing transform coding of the coding target imageor the predictive residual image in each unit of said transform block tooutput transform coefficients, quantizing the output transformcoefficients on the basis of a quantization parameter to outputquantized transform coefficients, and performing compression coding ofcoding-related information containing the quantized transformcoefficients and the quantization parameter to yield coded data, whereinthe decoding part has a function of converting the quantized transformcoefficients in the coding target block to a one-dimensional stringaccording to frequencies and decoding a zero run value being a number ofconsecutive coefficients providing 0 as an absolute value of thequantized transform coefficients in the one-dimensional string, a levelvalue being an absolute value of a said quantized transform coefficient,and a positive/negative sign indicating whether the quantized transformcoefficient is positive or negative, and comprises a decoded symbolmemory for memorizing the coding-related information previously decoded;a decoding procedure provider for providing one or more types ofdecoding procedures; and a decoded data outputting part for selecting adecoding procedure which is one of the decoding procedures provided bythe decoding procedure provider and which corresponds to a codingprocedure used in the coding of the coding-related information as adecoding target, based on a predetermined coding procedure selectioncriterion, using the coding-related information previously decoded andstored in the decoded symbol memory, and for decoding the coding-relatedinformation on the basis of the selected decoding procedure to outputdecoded data.

In order to achieve the above object, another image encoding method ofthe present invention is an image encoding method comprising: atransform step of dividing a coding target image or a predictiveresidual image generated based on the coding target image, intopredetermined transform blocks, and performing transform coding of thecoding target image or the predictive residual image in each unit ofsaid transform block to output transform coefficients; a quantizationstep of quantizing the transform coefficients outputted in the transformstep, based on a quantization parameter, to output quantized transformcoefficients; and an encoding step of performing compression coding ofcoding-related information containing the quantization parameter and thequantized transform coefficients outputted in the quantization step, tooutput coded data; wherein the encoding step is a step of converting thequantized transform coefficients in the coding target block to aone-dimensional string according to frequencies and encoding a zero runvalue being a number of consecutive coefficients providing 0 as anabsolute value of the quantized transform coefficients in theone-dimensional string, a level value being an absolute value of a saidquantized transform coefficient, and a positive/negative sign indicatingwhether the quantized transform coefficient is positive or negative, andis to prepare one or more types of coding procedures, select a codingprocedure out of the one or more types of coding procedures, based on apredetermined coding procedure selection criterion, using thecoding-related information stored in a coded symbol memory, and performthe compression coding of the coding-related information on the basis ofthe selected coding procedure to output the coded data.

Another image decoding method corresponding thereto is an image decodingmethod comprising: a decoding step of decoding coded data obtained bydividing a coding target image or a predictive residual image generatedbased on the coding target image, into predetermined transform blocks,performing transform coding of the coding target image or the predictiveresidual image in each unit of said transform block to output transformcoefficients, quantizing the output transform coefficients on the basisof a quantization parameter to output quantized transform coefficients,and performing compression coding of coding-related informationcontaining the quantized transform coefficients and the quantizationparameter to yield coded data, wherein the decoding step is a step ofconverting the quantized transform coefficients in the coding targetblock to a one-dimensional string according to frequencies and decodinga zero run value being a number of consecutive coefficients providing 0as an absolute value of the quantized transform coefficients in theone-dimensional string, a level value being an absolute value of thequantized transform coefficients, and a positive/negative codeindicating whether the quantized transform coefficient is positive ornegative, and is to prepare one or more types of decoding procedures,select a decoding procedure which is one of the one or more types ofdecoding procedures and which corresponds to a coding procedure used inthe coding of the coding-related information as a decoding target, basedon a predetermined coding procedure selection criterion, using thecoding-related information previously decoded and stored in a decodedsymbol memory, and decode the coding-related information on the basis ofthe selected decoding procedure to output decoded data.

In order to achieve the above object, another image encoding program ofthe present invention is an image encoding program for letting acomputer function as: transform means for dividing a coding target imageor a predictive residual image generated based on the coding targetimage, into predetermined transform blocks, and for performing transformcoding of the coding target image or the predictive residual image ineach unit of said transform block to output transform coefficients;quantization means for quantizing the transform coefficients outputtedfrom the transform means, based on a quantization parameter, to outputquantized transform coefficients; and encoding means for performingcompression coding of coding-related information containing thequantization parameter and the quantized transform coefficientsoutputted from the quantization means, to output coded data; wherein theencoding means comprises means for converting the quantized transformcoefficients in the coding target block to a one-dimensional stringaccording to frequencies and encoding a zero run value being a number ofconsecutive coefficients providing 0 as an absolute value of thequantized transform coefficients in the one-dimensional string, a levelvalue being an absolute value of a said quantized transform coefficient,and a positive/negative sign indicating whether the quantized transformcoefficient is positive or negative, and further comprises codingprocedure providing means for providing one or more types of codingprocedures; and coded data outputting means for selecting one of thecoding procedures provided by the coding procedure providing means,based on a predetermined coding procedure selection criterion, using thecoding-related information stored in a coded symbol memory, and forperforming the compression coding of the coding-related information onthe basis of the selected coding procedure to output the coded data.

Another image decoding program corresponding thereto is an imagedecoding program for letting a computer function as: decoding means fordecoding coded data obtained by dividing a coding target image or apredictive residual image generated based on the coding target image,into predetermined transform blocks, performing transform coding of thecoding target image or the predictive residual image in each unit ofsaid transform block to output transform coefficients, quantizing theoutput transform coefficients on the basis of a quantization parameterto output quantized transform coefficients, and performing compressioncoding of coding-related information containing the quantized transformcoefficients and the quantization parameter to yield coded data, whereinthe decoding means comprises means for converting the quantizedtransform coefficients in the coding target block to a one-dimensionalstring according to frequencies and decoding a zero run value being anumber of consecutive coefficients providing 0 as an absolute value ofthe quantized transform coefficients in the one-dimensional string, alevel value being an absolute value of a said quantized transformcoefficient, and a positive/negative sign indicating whether thequantized transform coefficient is positive or negative, and furthercomprises decoding procedure providing means for providing one or moretypes of decoding procedures; and decoded data outputting means forselecting a decoding procedure which is one of the decoding proceduresprovided by the decoding procedure providing means and which correspondsto a coding procedure used in the coding of the coding-relatedinformation as a decoding target, based on a predetermined codingprocedure selection criterion, using the coding-related informationpreviously decoded and stored in a decoded symbol memory, and fordecoding the coding-related information on the basis of the selecteddecoding procedure to output decoded data.

The above-described image encoding apparatus, image encoding method, andimage encoding program are configured to prepare a plurality ofprocedures for performing the information source coding of onecoding-related information and select a procedure to be used in theinformation source coding of the coding-related information in a block,out of these procedures. Therefore, the procedure to be used in theinformation source coding, which is suitable for the property of eachcoding symbol varying as described above, can be selected from theplurality of procedures. As a result, it becomes feasible to efficientlyperform the information source coding of the coding symbol, according tothe coding condition and the property of image.

The above-described image decoding apparatus, image decoding method, andimage decoding program are configured to prepare a plurality ofprocedures for information source decoding of one coding-relatedinformation and select a procedure to be used in the information sourcedecoding of the coding-related information in a block, out of theseprocedures. Therefore, it is feasible to correctly decode the coded datacoded by the aforementioned image encoding apparatus, image encodingmethod, and image encoding program.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the level value, thecoding procedure provider provides a coding procedure of setting ashorter code length for a value closer to a level value at a frequencynear the coding target level value.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the level value, the decoding procedure provider provides adecoding procedure corresponding to a coding procedure provided so as toset a shorter code length for a value closer to a level value at afrequency near the coding target level value.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the level value, where azero run value at a frequency near the coding target level value islarger than a preset threshold, the coding procedure provider provides acoding procedure of decreasing a code length as the level value becomessmaller.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the level value, where a zero run value at a frequency nearthe coding target level value is larger than a preset threshold, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to decrease a code length as thelevel value becomes smaller.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the level value, thecoding procedure provider provides a coding procedure of setting alarger deviation of code lengths with increase in a frequency band ofthe coding target level value.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the level value, the decoding procedure provider provides adecoding procedure corresponding to a coding procedure provided so as toset a larger deviation of code lengths with increase in a frequency bandof the coding target level value.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the level value, thecoding procedure provider provides a coding procedure of setting asmaller deviation of code lengths as the level value becomes smaller ata frequency near the coding target level value.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the level value, the decoding procedure provider provides adecoding procedure corresponding to a coding procedure provided so as toset a smaller deviation of code lengths as the level value becomessmaller at a frequency near the coding target level value.

The image encoding apparatus of the present invention can also beconfigured so that, on the occasion of encoding the zero run value, thecoding procedure provider provides a coding procedure of setting alarger deviation of code lengths as the level value becomes smaller at afrequency near the coding target zero run value.

In the image decoding apparatus corresponding thereto, on the occasionof decoding the zero run value, the decoding procedure provider providesa decoding procedure corresponding to a coding procedure provided so asto set a larger deviation of code lengths as the level value becomessmaller at a frequency near the coding target zero run value.

The image encoding apparatus of the present invention can also beconfigured so that the encoding part has a function of performingcompression coding of a number of nonzero quantized transformcoefficients in the coding target block; where the number of nonzeroquantized transform coefficients in the coding target block is smallerthan a preset threshold, the encoding part encodes the level values andthe zero run values thereof in order from a lowest frequency component;where the number of nonzero quantized coefficients in the coding targetblock is larger than the preset threshold, the encoding part encodes thelevel values and the zero run values thereof in order from a highestfrequency component.

In the image decoding apparatus corresponding thereto, the decoding parthas a function of decoding a number of nonzero quantized transformcoefficients in the coding target block; where the number of nonzeroquantized coefficients in the coding target block is smaller than apreset threshold, the decoding part decodes the level values and thezero run values thereof in order from a lowest frequency component;where the number of nonzero quantized coefficients in the coding targetblock is larger than the preset threshold, the decoding part decodes thelevel values and the zero run values thereof in order from a highestfrequency component.

In order to achieve the above object, still another image encodingmethod of the present invention is an image encoding method of dividingan image into blocks of a predetermined size to effect coding thereof,and performing information source coding of coding-related informationin each unit of the foregoing block to provide output of coded data, theimage encoding method comprising preparing a plurality of means forperforming the information source coding of one coding-relatedinformation and selecting a means to be used in the information sourcecoding of the coding-related information in the block, out of theplurality of means.

In order to achieve the above object, still another image encodingapparatus of the present invention is an image encoding apparatus fordividing an image into blocks of a predetermined size to effect codingthereof, and performing information source coding of coding-relatedinformation in each unit of the foregoing block to provide output ofcoded data, the image encoding apparatus comprising a plurality of meansfor performing the information source coding of one coding-relatedinformation, wherein a means to be used in the information source codingof the coding-related information in the block is selected out of theplurality of means.

There are prepared a plurality of means for the information sourcecoding of one coding-related information and a means to be used in theinformation source coding of the coding-related information in a blockis selected out of these means, whereby it is feasible to select themeans to be used in the information source coding, which is suitable forthe property of each coding symbol varying in various ways, out of theplurality of means.

Still another image decoding method of the present invention is an imagedecoding method of decoding input of coded data obtained by dividing animage into blocks of a predetermined size and performinginformation-source coding of coding-related information in each unit ofthe block, the image decoding method comprising preparing a plurality ofmeans for performing information source decoding of one coding-relatedinformation and selecting a means to be used in the information sourcedecoding of the coding-related information in the block, out of theplurality of means.

Still another image decoding apparatus of the present invention is animage decoding apparatus for decoding input of coded data obtained bydividing an image into blocks of a predetermined size and performinginformation source coding of coding-related information in each unit ofthe block, the image decoding apparatus comprising a plurality of meansfor performing information source decoding of one coding-relatedinformation, wherein a means to be used in the information sourcedecoding of the coding-related information in the block is selected outof the plurality of means.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the means to be used in the informationsource coding is selected based on the coding-related informationapplied in the block.

When the means to be used in the information source coding is selectedbased on the coding-related information applied in the block, it isfeasible to perform the information source coding suitable for theproperty of the coding symbol varying according to the coding conditionapplied to the block as described above.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the means to be used in the informationsource decoding is selected based on the coding-related informationapplied in the block.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In this case, the coding-related information can contain coding-relatedinformation of the same kind coded prior to the coding of thecoding-related information in question, or coding-related information ofa different kind coded prior to the coding of the coding-relatedinformation in question; in addition, the means to be used in theinformation source coding can be selected based on an order on a codetable used in the information source coding of the coding-relatedinformation.

In the image encoding method or the image encoding apparatus of thepresent invention, the means to be used in the information source codingcan also be selected based on coding-related information applied in ablock located in the neighborhood to the block in question.

When the means to be used in the information source coding is selectedbased on the coding-related information applied in the block located inthe neighborhood to the block in question, it is feasible to estimatethe property of the coding-related information varying depending uponthe property of the image in the region on the image containing theblock in question, from the coding-related information in the blocklocated in the neighborhood, as described above, and perform theinformation source coding suitable for the property of thecoding-related information.

In the image decoding method or the image decoding apparatus of thepresent invention, the means to be used in the information sourcedecoding can also be selected based on coding-related informationapplied in a block located in the neighborhood to the block in question.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In this case, the coding-related information can contain coding-relatedinformation of the same kind as the coding-related information inquestion, or coding-related information of a kind different from thecoding-related information in question; and the means to be used in theinformation source coding can be selected based on an order on a codetable used in the information source coding of the coding-relatedinformation.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the plurality of means to be used in theinformation source coding have their respective, different orders ofassignment to a code table in the information source coding of thecoding-related information.

This permits the information source coding suitable for the property ofeach coding symbol to be performed even for the coding symbols varyingthe distribution of occurrence frequencies of coding symbols accordingto change in the property of the coding symbols as described previously.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the plurality of means to be used in theinformation source decoding have their respective, different orders ofassignment to a code table in the information source decoding of thecoding-related information.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, the plurality of means to be used in the informationsource coding can have their respective, different code configurationmethods in the information source coding of the coding-relatedinformation.

This permits the information source coding suitable for the property ofeach coding symbol to be performed even for the coding symbols varyingthe deviation of distribution of occurrence frequencies of codingsymbols according to change in the property of the coding symbols asdescribed previously.

In the image decoding method or the image decoding apparatus of thepresent invention, the plurality of means to be used in the informationsource decoding can have their respective, different code configurationmethods in the information source decoding of the coding-relatedinformation.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, there are prepared a plurality ofpredicting means for the coding-related information; and predicted valuesimilarity generating means for generating similarities of predictedvalues obtained as a result of the plurality of predicting means, andthe means to be used in the information source coding is selected basedon the similarities by the plurality of predicting means.

When the means to be used in the information source coding is selectedbased on the similarities of the predicted values obtained as a resultof the plurality of predicting means, it is feasible to efficientlyselect the means to be used in the information source coding.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, there are prepared a plurality ofpredicting means for the coding-related information; and predicted valuesimilarity generating means for generating similarities of predictedvalues obtained as a result of the plurality of predicting means, andthe means to be used in the information source decoding is selectedbased on the similarities by the plurality of predicting means.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method, image encoding apparatus, image decodingmethod, and image decoding apparatus of the present invention, thecoding-related information to be coded or decoded corresponds to codingmode information in a block as a target for coding, coded block patterninformation in the target block, motion vector information in the targetblock, a level value of an orthogonal transform coefficient in thetarget block, a number of nonzero coefficients among the orthogonaltransform coefficients in the target block, or the like.

In the image encoding method, image encoding apparatus, image decodingmethod, and image decoding apparatus of the present invention, thecoding-related information to be used in the selection of theabove-described means can contain coding mode information, aquantization parameter, coded block pattern information, a motionvector, a level value of an orthogonal transform coefficient, a numberof nonzero coefficients among the orthogonal transform coefficients, orthe like. Where the coding-related information to be used in theselection of the above-described means contains the coding modeinformation, it is possible to use an activity in a neighboring block,which is defined by the coding mode information. Where thecoding-related information to be used in the selection of theabove-described means contains the coded block pattern information, itis possible to use a directional deviation of an appearance pattern ofsignificant orthogonal transform coefficients in a neighboring block,which is defined by the coded block pattern information.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source coding are updated independently of each otheraccording to the result of the coding.

When the means are updated independently of each other according to theresult of the coding, it is feasible to perform the information sourcecoding more suiting the coding condition and the property of image.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source decoding are updated independently of each otheraccording to the result of the decoding.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In order to achieve the above object, an image transmission system ofthe present invention is an image transmission system comprising animage encoder for encoding an image; a bit stream transmitter fortransmitting a bit stream encoded by the image encoder; a bit streamreceiver for receiving the bit stream thus transmitted; and an imagedecoder for decoding the received bit stream, wherein the image encoderperforms the encoding by one of the aforementioned image encodingmethods.

By performing the encoding by one of the aforementioned image encodingmethods, the means to be used in the information source coding, which issuitable for the property of the coding symbol varying in various ways,can be selected out of the plurality of means.

Another image transmission system of the present invention is an imagetransmission system comprising an image encoder for encoding an image; abit stream transmitter for transmitting a bit stream encoded by theimage encoder; a bit stream receiver for receiving the bit stream thustransmitted; and an image decoder for decoding the received bit stream,wherein the image decoder performs the decoding by one of theaforementioned image decoding methods.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by one of the aforementioned image encoding methods.

In order to achieve the above object, an image storage system of thepresent invention is an image storage system comprising an image encoderfor encoding an image; and a bit stream storage for storing a bit streamencoded by the image encoder, wherein the image encoder performs theencoding by one of the aforementioned image encoding methods.

By performing the encoding by one of the aforementioned image encodingmethods, the means to be used in the information source coding, which issuitable for the property of the coding symbol varying in various ways,can be selected out of the plurality of means.

An image reproduction system of the present invention is an imagereproduction system comprising a bit stream storage for retaining a bitstream stored; and an image decoder for decoding a bit stream read outof the bit stream storage, wherein the image decoder performs thedecoding by one of the aforementioned image decoding methods.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by one of the aforementioned image encoding methods.

In order to achieve the above object, another image encoding method ofthe present invention is an image encoding method of dividing an imageinto blocks of a predetermined size, performing an orthogonal transformthereof, and performing information source coding of orthogonaltransform coefficient information, the image encoding method comprisingpreparing a plurality of means for performing the information sourcecoding, and selecting a means to be used in the information sourcecoding of the orthogonal transform coefficient information, out of theplurality of means.

Another image encoding apparatus of the present invention is an imageencoding apparatus for dividing an image into blocks of a predeterminedsize, performing an orthogonal transform thereof, and performinginformation source coding of orthogonal transform coefficientinformation, the image encoding apparatus comprising a plurality ofmeans for performing the information source coding, wherein a means tobe used in the information source coding of the orthogonal transformcoefficient information is selected out of the plurality of means.

There are prepared a plurality of means for performing the informationsource coding of the orthogonal transform coefficient information and ameans to be used in the information source coding of the orthogonaltransform coefficient information is selected out of the plurality ofmeans, whereby it is feasible to select the means to be used in theinformation source coding, which is suitable for the property of theorthogonal transform coefficient information varying in various ways,out of the plurality of means.

Another image decoding method of the present invention is an imagedecoding method of decoding input of coded data obtained by dividing animage into blocks of a predetermined size, performing an orthogonaltransform thereof, and performing information source coding oforthogonal transform coefficient information, the image decoding methodcomprising preparing a plurality of means for performing informationsource decoding, and selecting a means to be used in the informationsource decoding of the orthogonal transform coefficient information, outof the plurality of means.

Furthermore, another image decoding apparatus of the present inventionis an image decoding apparatus for decoding input of coded data obtainedby dividing an image into blocks of a predetermined size, performing anorthogonal transform thereof, and performing information source codingof orthogonal transform coefficient information, the image decodingapparatus comprising a plurality of means for performing informationsource decoding, wherein a means to be used in the information sourcedecoding of the orthogonal transform coefficient information is selectedout of the plurality of means.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the means to be used in the informationsource coding is selected based on a coefficient value of a significantcoefficient in the orthogonal transform coefficient informationtransmitted in advance.

When the means to be used in the information source coding is selectedbased on the coefficient value of the significant coefficient in theorthogonal transform coefficient information, it is feasible to predicta change in the property of the orthogonal transform coefficientinformation varying in various ways, from the coefficient valuetransmitted in advance, and perform the information source codingsuitable for the property of the orthogonal transform coefficientinformation.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the means to be used in the informationsource decoding is selected based on a coefficient value of asignificant coefficient in the orthogonal transform coefficientinformation transmitted in advance.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, the means to be used in the information source codingcan also be selected based on a zero run count in the orthogonaltransform coefficient information transmitted in advance.

When the means to be used in the information source coding is selectedbased on the zero run count in the orthogonal transform coefficientinformation, it is feasible to predict a change in the property of theorthogonal transform coefficient information varying in various ways,from the zero run count transmitted in advance, and perform theinformation source coding suitable for the property of the orthogonaltransform coefficient information.

In the image decoding method or the image decoding apparatus of thepresent invention, the means to be used in the information sourcedecoding can also be selected based on a zero run count in theorthogonal transform coefficient information transmitted in advance.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, the means to be used in the information source codingcan also be selected based on a space frequency to which the orthogonaltransform coefficient information belongs.

When the means to be used in the information source coding is selectedbased on the space frequency to which the orthogonal transformcoefficient information belongs, it is feasible to predict a change inthe property of the orthogonal transform coefficient information varyingin various ways, from the space frequency, and perform the informationsource coding suitable for the property of the orthogonal transformcoefficient information.

In the image decoding method or the image decoding apparatus of thepresent invention, the means to be used in the information sourcedecoding can also be selected based on a space frequency to which theorthogonal transform coefficient information belongs.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source coding have their respective, different orders ofassignment to a code table in the information source coding of theorthogonal transform coefficient information.

This permits the information source coding suitable for the property ofthe orthogonal transform coefficient information to be performed even ifthe property of the orthogonal transform coefficient information varies,so as to change frequencies of occurrence of respective informationitems.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source decoding have their respective, different orders ofassignment to a code table in the information source decoding of theorthogonal transform coefficient information.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source coding have their respective, different codeconfiguration methods in the information source coding of the orthogonaltransform coefficient information.

This permits the information source coding suitable for the property ofthe orthogonal transform coefficient information to be performed even ifthe property of the orthogonal transform coefficient information varies,so as to change the deviation of distribution of occurrence frequenciesof respective information items.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the plurality of means used in theinformation source decoding have their respective, different codeconfiguration methods in the information source decoding of theorthogonal transform coefficient information.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, the information source coding of the orthogonaltransform coefficient information may be carried out for a combinationof a zero run count and a coefficient value in an orthogonal transformcoefficient string, or may be carried out individually for each of thezero run count and coefficient value in the orthogonal transformcoefficient string.

Similarly, in the image decoding method or the image decoding apparatusof the present invention, the information source decoding of theorthogonal transform coefficient information may be carried out for acombination of a zero run count and a coefficient value in an orthogonaltransform coefficient string, or may be carried out individually foreach of the zero run count and coefficient value in the orthogonaltransform coefficient string.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, consecutive numbers with a level value ofequal magnitude are assigned as the orthogonal transform coefficientinformation to a code table.

By adopting this configuration, it becomes feasible to perform moreefficient coding.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, consecutive numbers with a level value ofequal magnitude are assigned as the orthogonal transform coefficientinformation to a code table.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, whether the orthogonal transformcoefficient information should be encoded in order from a lowestfrequency component or from a highest frequency component is determinedaccording to coding information in a coding target block.

By adopting this configuration, it becomes feasible to perform moreefficient coding.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, whether the orthogonal transformcoefficient information should be decoded in order from a lowestfrequency component or from a highest frequency component is determinedaccording to previously decoded information in a decoding target block.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the means to be used in the informationsource coding is selected based on a motion vector difference value inthe coding target block transmitted in advance.

When the means to be used in the information source coding is selectedbased on the motion vector difference value in the coding target blocktransmitted in advance, it is feasible to predict a change in theproperty of the orthogonal transform coefficient information varying invarious ways, from the motion vector difference value transmitted inadvance, and perform the information source coding suitable for theproperty of the orthogonal transform coefficient information.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the means to be used in the informationsource decoding is selected based on a motion vector difference value inthe decoding target block transmitted in advance.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, preferably, the orthogonal transform coefficientinformation as the coding target is a total of zero run lengths in ablock.

By adopting this configuration, it is feasible to efficiently encode thetotal of zero run lengths.

In the image decoding method or the image decoding apparatus of thepresent invention, preferably, the orthogonal transform coefficientinformation as the decoding target is a total of zero run lengths in ablock.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by the aforementioned image encoding method or imageencoding apparatus.

In order to achieve the above object, another image transmission systemof the present invention is an image transmission system comprising animage encoder for encoding an image; a bit stream transmitter fortransmitting a bit stream encoded by the image encoder; a bit streamreceiver for receiving the bit stream thus transmitted; and an imagedecoder for decoding the received bit stream, wherein the image encoderperforms the encoding by one of the aforementioned image encodingmethods.

When the coding is performed by one of the foregoing image encodingmethods, it is feasible to perform the information source codingsuitable for the property of the orthogonal transform coefficientinformation varying in various ways.

In order to achieve the above object, another image transmission systemof the present invention is an image transmission system comprising animage encoder for encoding an image; a bit stream transmitter fortransmitting a bit stream encoded by the image encoder; a bit streamreceiver for receiving the bit stream thus transmitted; and an imagedecoder for decoding the received bit stream, wherein the image decoderperforms the decoding by one of the aforementioned image decodingmethods.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by one of the aforementioned image encoding methods.

In order to achieve the above object, another image storage system ofthe present invention is an image storage system comprising an imageencoder for encoding an image; and a bit stream storage for storing abit stream encoded by the image encoder, wherein the image encoderperforms the encoding by one of the aforementioned image encodingmethods.

When the encoding is carried out by one of the aforementioned imageencoding methods, it is feasible to perform the information sourcecoding suitable for the property of the orthogonal transform coefficientinformation varying in various ways.

In order to achieve the above object, another image reproduction systemof the present invention is an image reproduction system comprising abit stream storage for retaining a bit stream stored; and an imagedecoder for decoding a bit stream read out of the bit stream storage,wherein the image decoder performs the decoding by one of theaforementioned image decoding methods.

By adopting this configuration, it is feasible to correctly decode thecoded data coded by one of the aforementioned image encoding methods.

In the image encoding method or the image encoding apparatus of thepresent invention, there are prepared a plurality of means forperforming the information source coding of one coding-relatedinformation, and one means to be used in the information source codingof the coding-related information in a block is selected from thesemeans. Therefore, the means to be used in the information source codingsuitable for the property of the coding symbol varying as describedabove can be selected out of the plurality of means. As a result, itbecomes feasible to efficiently perform the information source coding ofthe coding symbol, according to the coding condition and the property ofimage.

In the image decoding method or the image decoding apparatus of thepresent invention, there are prepared a plurality of means forperforming the information source decoding of one coding-relatedinformation, and one means to be used in the information source decodingof the coding-related information in a block is selected from thesemeans. Therefore, it is feasible to correctly decode the coded datacoded by the aforementioned image encoding method or image encodingapparatus.

In the image encoding method or the image encoding apparatus of thepresent invention, there are prepared a plurality of means forperforming the information source coding of orthogonal transformcoefficient information, and a means to be used in the informationsource coding of the orthogonal transform coefficient information isselected out of the plurality of means. Therefore, a means to be used inthe information source coding suitable for the property of theorthogonal transform coefficient information varying in various ways canbe selected out of the plurality of means. As a result, it becomesfeasible to perform the information source coding suitable for theproperty of the orthogonal transform coefficient information, as changedaccording to a frequency domain of orthogonal transform coefficients ora tendency of other orthogonal transform coefficients, and therebyimplement efficient coding.

In the image decoding method or the image decoding apparatus of thepresent invention, there are prepared a plurality of means forperforming the information source decoding of orthogonal transformcoefficient information, and a means to be used in the informationsource decoding of the orthogonal transform coefficient information isselected out of the plurality of means. Therefore, it is feasible tocorrectly decode the coded data coded by the aforementioned imageencoding method or image encoding apparatus.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart schematically showing an example of the movingpicture encoding technique according to the prior art.

FIG. 2 is a block diagram schematically showing an example of the movingpicture encoding apparatus according to the prior art.

FIGS. 3A-3C are diagrams showing an example of types of macroblockcoding modes according to the prior art.

FIGS. 4A and 4B are diagrams showing an example of the orthogonaltransform according to the prior art.

FIG. 5 is a flowchart schematically showing an example of the movingpicture decoding technique according to the prior art.

FIG. 6 is a block diagram schematically showing an example of the movingpicture decoding apparatus according to the prior art.

FIGS. 7A and 7B are diagrams showing an example of distribution ofnonzero quantized orthogonal transform coefficients.

FIG. 8 is a diagram showing relations among blocks in a macroblock andadjacent blocks.

FIGS. 9A and 9B are diagrams showing an example of a map tableindicating a relation between coded block pattern information of lumasignals and index values and, an example of a variable-length codingtable indicating a relation between index values and variable-lengthcodes.

FIGS. 10A and 10B are diagrams showing an example of application inwhich switching between map tables according to the present invention isapplied to the coded block pattern information of luma signals.

FIGS. 11A and 11B are diagrams showing an example of a map tableindicating a relation between the coded block pattern information ofchroma signals and index values and, an example of a variable-lengthcoding table indicating a relation between index values andvariable-length codes.

FIGS. 12A and 12B are diagrams showing an example of application inwhich switching between map tables according to the present invention isapplied to the coded block pattern information of chroma signals.

FIG. 13 is a block diagram schematically showing an example of avariable-length encoder according to the present invention.

FIG. 14 is a block diagram schematically showing an example of avariable-length decoder according to the present invention.

FIGS. 15A and 15B are diagrams showing an example of locations of blocksused in generation of context of the coded block pattern informationaccording to the present invention.

FIGS. 16A and 16B are diagrams schematically showing configurations ofmacroblocks and coded block pattern information in the H.26L encodingsystem.

FIGS. 17A and 17B are diagrams showing relations among a macroblock andadjacent blocks where the present invention is applied in the H.26Lencoding system.

FIGS. 18A-18D are diagrams showing an example of application in whichswitching between map tables according to the present invention isapplied to the coded block pattern information in the H.26L encodingsystem.

FIG. 19 is a diagram showing an example of application in whichswitching between map tables according to the present invention isapplied to the coded block pattern information of chroma signals in theH.26L encoding system.

FIGS. 20A and 20B are diagrams showing an example of distribution ofoccurrence probabilities of respective symbols of coded block patterninformation.

FIGS. 21A-21C are diagrams showing an example of a plurality ofvariable-length coding tables with different characteristics.

FIGS. 22A-22D are diagrams schematically showing an encoding method ofquantized orthogonal transform coefficients.

FIG. 23 is a diagram showing a positional relation among a coding targetmacroblock and adjacent macroblocks.

FIGS. 24A-24J are diagrams schematically showing another example oftypes of macroblock coding modes.

FIG. 25 is a diagram showing an example of definition of points for therespective macroblock coding modes.

FIGS. 26A and 26B are diagrams showing an example of a map tableindicating a relation between macroblock coding modes and index valuesand, an example of a variable-length coding table indicating a relationbetween index values and variable-length codes.

FIG. 27 is a diagram showing another example of definition of points forthe macroblock coding modes.

FIGS. 28A and 28B are diagrams showing another example of a map tableindicating a relation between macroblock coding modes and index valuesand, another example of a variable-length coding table indicating arelation between index values and variable-length codes.

FIG. 29A is a diagram schematically showing a configuration of an imagetransmission system.

FIG. 29B is a diagram schematically showing a configuration of an imagestorage system.

FIG. 29C is a diagram schematically showing a configuration of an imagereproduction system.

FIG. 30 is a block diagram schematically showing an example of thevariable-length encoder according to the present invention.

FIG. 31 is a diagram showing a map table MT(CX) where CX takes valuesfrom 0 to 7.

FIG. 32 is a block diagram schematically showing an example of thevariable-length decoder according to the present invention.

FIG. 33 is a diagram showing a positional relation among a coding targetmacroblock and adjacent macroblocks.

FIGS. 34A and 34B are diagrams showing an example of a map tableindicating a relation between nonzero quantized orthogonal transformcoefficient values and index values and, an example of a variable-lengthcoding table indicating a relation between index values and variablelengths.

FIGS. 35A and 35B are diagrams showing an example of change of the maptable according to the present invention, and an example of a codestring using the map table after the change.

FIG. 36 is a diagram showing an example of the map table in whichconsecutive numbers with the absolute value of Level value of 1 areassigned in the code table.

FIGS. 37A-37C are diagrams showing another example of a plurality ofvariable-length coding tables with different characteristics.

FIGS. 38A-38C are diagrams showing probability tables.

BEST MODES FOR CARRYING OUT THE INVENTION First Embodiment

Embodied forms of the image encoding method, image decoding method,image encoding apparatus, image decoding apparatus, image transmissionsystem, image storage system, and image reproduction system according tothe first embodiment of the present invention will be described below indetail with reference to the drawings. The same elements will be denotedby the same reference symbols throughout the description of thedrawings, without redundant description thereof. It is also noted thatdimensional ratios in the drawings do not always agree with those in thedescription. In the description hereinafter, the embodiment will bedescribed on the presumption that an input frame image fed as a codingtarget is a moving picture consisting of time-series frame images.

The procedure of variable-length coding of the CBP in codingsupplementary information D8 and the suitable coding condition thereof,which are the features of the first embodiment of the present invention,will be described below with specific examples thereof, using the MPEG-4coding system as an example. It is noted that the coding method andcoding condition described below can also be applied similarly to theimage encoding method and image encoding apparatus shown in FIGS. 1 and2 and to the image decoding method and image decoding apparatus shown inFIGS. 5 and 6. It is also noted that the specific encoding system anddecoding system do not have to be limited to the foregoing MPEG-4encoding system.

In MPEG-4 the CBP is a flag indicating whether there is a nonzero ACcomponent among the orthogonal transform coefficients in each block in amacroblock for which the intra coding mode is selected. It is also aflag indicating whether there is a nonzero DC component or nonzero ACcomponent among the orthogonal transform coefficients in each block in amacroblock for which the inter coding mode is selected.

Incidentally, an area with nonzero orthogonal transform coefficients issignificantly dependent upon the spatial characteristics of image andthe quantization parameter. FIGS. 7A and 7B are conceptual diagramsshowing the relationship between the spatial characteristics of imageand nonzero orthogonal transform coefficients. As shown in FIGS. 7A and7B, there is less motion in the background part in the screen, where itis relatively easy to make a correct motion compensated prediction;therefore, nonzero orthogonal transform coefficients are unlikely toappear. Conversely, the moving figure part in the screen contains hardmotion to cause considerable change of texture, so that there appearmany residuals by the motion compensated prediction. For this reason,nonzero orthogonal transform coefficients are likely to appear in suchareas. Namely, nonzero orthogonal transform coefficients are unlikely toappear in areas with small change in texture and motion, whereas nonzeroorthogonal transform coefficients are likely to appear in areas withlarge change in texture and motion. Particularly, in the case of naturalimages and the like, it is often the case that tendencies of change inshape and motion are similar in neighboring areas.

Here, as shown in FIG. 8, let blocks of a coding target macroblock in aluma component image be block A, block B, block C, and block D in theraster scan order, and lower blocks of a macroblock adjacent above beblock E and block F. Furthermore, let right blocks of a macroblockadjacent left be block G and block H. In addition, let blocks of Cb andCr in a coding target macroblock be blocks I and L, respectively; blocksadjacent above be blocks J and M; and blocks adjacent left be blocks Kand N.

Then, for example, where nonzero orthogonal transform coefficients existin all the blocks E, F, and G, we can infer from analogy inconsideration of the spatial continuity of the image that there is ahigh possibility that nonzero orthogonal transform coefficients alsoexist in block A. Conversely, for example, where neither of the blocksE, F, and G contains nonzero orthogonal transform coefficients, we caninfer from analogy that there is a high possibility that no nonzeroorthogonal transform coefficients exist in block A, either. In thismanner, for each block of the coding target macroblock, the probabilityof existence of nonzero orthogonal transform coefficients in the codingtarget macroblock varies depending upon the presence/absence of nonzeroorthogonal transform coefficients in neighboring blocks. In view of theabove, the image encoding method in the first embodiment of the presentinvention is characterized in that efficient coding can be implementedby generating the spatial context on the basis of the presence/absenceof nonzero orthogonal transform coefficients in neighboring blocks tothe coding target macroblock and switching between map tables used inthe variable-length coding of the CBP of the coding target macroblock,on the basis of the spatial context.

The following will describe an example of means for switching betweenmap tables used in the variable-length coding to encode the CBP in thefirst embodiment of the present invention. First, the spatial context isintroduced, as described below, for CBPY which is the CBP for the lumacomponents and for CBPC which is the CBP for the chroma components, andthe method is configured to switch between map tables according to thespatial context.

FIG. 9A shows a map table in which CBPYs are associated with indexvalues corresponding to the respective CBPYs. FIG. 9B shows an exampleof a variable-length coding table in which index values are associatedwith variable-length codes corresponding to the respective index values.A CBPY is expressed by four bits, which correspond to blocks A, B, C,and D in order from the MSB (Most Significant Bit) and each of whichindicates 1 for the presence of a nonzero orthogonal transformcoefficient or 0 for the absence thereof. Here, let us introduce pointsP(A), P(B), and P(C), and operator “==,” in order to expresscorrelations between blocks A, B, C, D and neighboring blocks. Theoperator “==” is an operator that returns 1 where two numerals areequal, but 0 where they are unequal. Namely, where CBP(A) being the CBPof block A is equal to CBP(G) being the CBP of block G, the result ofthe operation of Eq (1) below is 1.CBP(A)==CBP(G)  Eq (1)

In other words, where CBP(A) and CBP(G) both are 1 or 0, the operationresult of Eq (1) is 1; otherwise, the operation result of Eq (1) is 0.Points P(A), P(B), and P(C) are also defined herein by Eqs (2), (3), and(4) below.P(A)=2·(CBP(A)==CBP(E))+2·(CBP(A)==CBP(G))+(CBP(A)==CBP(H))+(CBP(A)==CBP(F))  Eq(2)P(B)=4·(CBP(B)==CBP(F))+2·(CBP(B)==CBP(E))  Eq (3)P(C)=4·(CBP(C)==CBP(H))+2·(CBP(C)==CBP(G))  Eq (4)

These equations permit degrees of correlations of the CBPs of blocks A,B, and C with those of the neighboring blocks to be expressed by pointsP(A), P(B), and P(C).

P(A), P(B), and P(C) are calculated for all the patterns in the maptable shown in FIGS. 9A, 9B, and a total thereof is defined as P(CBPY).Namely, P(CBPY) is represented by the following equation.P(CBPY)=P(A)+P(B)+P(C)  Eq (5)

However, if a neighboring block to the coding target macroblock isoutside the screen or outside a given slice, the operation result by theoperator “==” is always set to 0 because of no correlation. Namely, forexample, where blocks G, H are outside the screen or outside the slice,for example, values of (CBP(A)==CBP(G)) and (CBP(A)==CBP(H)) are always0.

The P(CBPY) obtained in this manner provides a larger value for a CBPYhaving a higher spatial correlation with CBPYs in the neighborhood ofthe coding target macroblock. This means that the P(CBPY) takes a largervalue for a CBPY assumed to have a higher probability of occurrence onthe basis of the spatial context. Then a map table is created byrearranging the order of index values in FIG. 9A so as to assign theindex values of CBPYs in increasing order from the smallest to theP(CBPY)'s obtained in this way, starting from the largest P(CBPY).However, where two P(CBPY)'s are equal, one with a smaller index valuein the map table of FIG. 9A is also assigned a smaller index value inthe new map table. FIGS. 10A and 10B show the map tables of CBPY inrespective examples where the CBPs of the blocks E, F, G, and H are 1,1, 0, 0, respectively (FIG. 10A) and where they are 0, 1, 1, 0,respectively (FIG. 10B).

For CBPC, the map table is also switched to another in much the samemanner on the basis of the spatial context. FIG. 11A shows an example ofthe map table of CBPC, and FIG. 11B an example of the variable-lengthcoding table of CBPC. A CBPC is expressed by two bits, which correspondto Cb and Cr in order from the MSB side and each of which indicates 1for the presence of a nonzero orthogonal transform coefficient or 0 forthe absence thereof. In accordance with FIG. 8, just as in the case ofCBPY, P(I), P(L), and P(CBPC) are defined by Eqs (6), (7), and (8)below.P(I)=(CBP(I)==CBP(J))+(CBP(I)==CBP(K))  Eq (6)P(L)=(CBP(L)==CBP(M))+(CBP(L)==CBP(N))  Eq (7)P(CBPC)=P(I)+P(L)  (8)

However, where a neighboring block to the coding target macroblock isoutside the screen or outside a given slice, the operation result by theoperator “==” is always set to 0 because of no correlation. Namely, forexample, where block K is outside the screen or outside the slice, forexample, the value of (CBP(I)==CBP(K)) is always set to 0.

The P(CBPC) obtained in this manner provides a larger value for a CBPChaving a higher spatial correlation with CBPCs in the neighborhood ofthe coding target macroblock. Namely, the P(CBPC) takes a larger valuefor a CBPC assumed to have a higher probability of occurrence on thebasis of the spatial context. Then a map table is created by rearrangingthe order of index values in FIG. 11A to assign the index values ofCBPCs in increasing order from the smallest to the values of P(CBPC)'sobtained in this way, starting from the largest P(CBPC). However, wheretwo P(CBPC)'s are equal, one with a smaller index value in the map tableof FIG. 11A is also assigned a smaller index value in the new map table.FIGS. 12A and 12B show the map tables of CBPC in respective exampleswhere the CBPs of J, K, M, and N in FIG. 8 are (0, 1, 0, 0),respectively (FIG. 12A), and where they are (0, 0, 1, 1), respectively(FIG. 12B).

As described above, since the first embodiment of the present inventionis configured to switch the map tables of CBPY and CBPC in considerationof the continuity of image, it is feasible to assign short codewords tosymbols likely to appear and long codewords to symbols unlikely toappear, and thereby encode the CBP suitably.

FIG. 13 is an illustration showing a block diagram of variable-lengthencoder 16 according to the first embodiment of the present invention.Namely, in the variable-length encoder 16 of FIG. 13, the CBPs are firstfed as input symbols H1 into variable-length code output part 30. Thencoded symbol memory 31 feeds the CBPs in neighboring blocks as codingmap table reference information H2 into coding map table provider 32.Then coding map table provider 32 determines a coding map table to beused for the coding of the CBPs, on the basis of the aforementionedtechnique, and provides the coding map table H4 to the variable-lengthcode output part 30. Variable-length coding table provider 33 also feedsa variable-length coding table H5 into the variable-length code outputpart 30. Variable-length coding table reference information H3 can befed into variable-length coding table provider 33, but this input is notalways essential in the present embodiment. Then the coding target CBPsare variable-length coded to be outputted as coded data D9.

In the first embodiment of the present invention only the blocksadjacent to the coding target macroblock were referred to on theoccasion of generating the spatial context of CBPs, but, without havingto be limited to the adjacent blocks, it is a matter of course that thespatial context can be generated by utilizing additional information ofCBPs of blocks that are not adjacent to the coding target macroblock butthat exist in the neighborhood, for example as shown in FIG. 15A, orthat the spatial context can also be generated by utilizing informationof blocks in macroblocks not used in the first embodiment of the presentinvention, for example as shown in FIG. 15B, with similar effect.

The encoding method in the first embodiment of the present invention wasdescribed in the configuration wherein the CBPY and CBPC each wereseparately variable-length encoded using the separate variable-lengthcoding tables, but it is a matter of course that similar effect can alsobe attained by encoding the CBPY and CBPC together while effectingswitching of the map table using a variable-length coding table and maptable for CBPs, for example, expressed by six bits wherein four bitsfrom the MSB represent the CBPY and two bits from the LSB the CBPC. Inthis case, the encoding method may also be configured to effectswitching of the variable-length coding table, using the P(CBPY) andP(CBPC) calculated by Eq (5) and Eq (8), and, for example, utilizing thevalue of P(CBP) obtained by Eq (9) below.P(CBP)=P(CBPY)+P(CBPC)  Eq (9)

Since in the encoding method according to the first embodiment of thepresent invention the spatial context was generated on the basis of theinformation in the neighboring blocks previously coded, a similarspatial context can also be regenerated on the occasion of decoding, andswitching among variable-length decoding tables can be effected insimilar fashion to that on the encoder side.

Namely, in the block diagram of variable-length decoder 21 shown in FIG.14, when coded data D9 coded by the encoding method according to thefirst embodiment of the present invention is fed into decoded symboloutput part 40 of the variable-length decoder 21, decoded symbol memory41 feeds the CBPs of neighboring blocks from the symbols previouslydecoded, as decoding map table reference information H7 into decodingmap table provider 42. Then decoding map table provider 42 selects adecoding map table H9 by procedure similar to that in the coding andfeeds it to decoded symbol output part 40. Variable-length decodingtable provider 43 feeds a variable-length decoding table H10 intodecoded symbol output part 40. Variable-length decoding table referenceinformation H8 can be fed into the variable-length decoding tableprovider 43, but this input is not always essential in the presentembodiment. Then decoded symbol output part 40 performs variable-lengthdecoding to decode and output the CBPs as decoded symbols H6, andsimultaneously stores them into decoded symbol memory 41.

It follows that the decoding method in the first embodiment of thepresent invention can suitably decode the CBPs encoded by the encodingmethod in the first embodiment of the present invention.

The encoding method in the first embodiment of the present invention wasdescribed using the MPEG-4 encoding system as an example, but it is amatter of course that similar effect can also be achieved in the otherencoding systems by similarly generating the spatial context for thecoding of CBPs and effecting the switching of the variable-length codingtable on the basis of the spatial context. The following will describean example of application in which the first embodiment of the presentinvention is applied to the encoding method of CBPs in the H.26Lencoding system as another encoding system.

FIGS. 16A and 16B show configurations of macroblocks and configurationsof CBPs in the H.26L encoding system. In H.26L a macroblock of a lumacomponent image is of the size of 16 pixels×16 lines, while macroblocksof two types of chroma component images are of the size of 8 pixels×8lines. The orthogonal transform is carried out in units of 4 pixels×4lines for each macroblock, and the DC components of the chroma componentimages out of the orthogonal transform coefficients generated in thisway are further subjected to the orthogonal transform of 2 pixels×2lines. In the case of macroblocks intra-coded, there are two types ofcoding modes, intra 4×4 coding mode and intra 16×16 coding mode, ascoding modes, and configurations of CBPs in the respective modes aredifferent.

First, in the intra 4×4 coding mode, as to the CBPY, a macroblock isdivided into four blocks of 8 pixels×8 lines, as in MPEG-4, and whethera nonzero orthogonal transform coefficient exists in each block isindicated. On the other hand, the CBPC has three cases of “0,” “1,” and“2.” The CBPC “0” indicates that no nonzero orthogonal transformcoefficient exists as to the chroma components. The CBPC “1” indicatesthat a nonzero orthogonal transform coefficient exists only in the DCcomponents of the chroma components but no nonzero orthogonal transformcoefficient exists in the AC components. The CBPC “2” indicates that atleast one nonzero orthogonal transform coefficient exists in the ACcomponents of the chroma components. The inter-coded macroblocks havethe configurations of CBPs similar to those in the intra 4×4 codingmode. In the CBPs in the intra 16×16 coding mode, the CBPY is comprisedof only one bit indicating whether a nonzero orthogonal transformcoefficient exists in the AC component in a macroblock. The CBPC in theintra 16×16 coding mode is similar to that in the intra 4×4 coding mode.

First, since the configuration of CBPY is similar to that in MPEG-4except for the case of the intra 16×16 coding mode, the other encodingmethods can adopt methods similar to those in the case where theinvention was applied to MPEG-4, while handling only the case in theintra 16×16 coding mode as an exceptional process. Where the codingtarget macroblock in FIG. 8 is coded in the intra 16×16 coding mode, theP(CBPY) is calculated, for example, using Eq (10) below, and a CBPYyielding a larger value of P(CBPY) is given a higher priority. As shownin FIG. 17A, the entire coding target macroblock is defined as block Q,and CBP(Q) represents the value of CBPY in the coding target macroblock.FIGS. 18A and 18B show a map table and a variable-length coding table incoding of CBPY in the application to H.26L, similar to FIGS. 9A, 9B.P(CBPY)=(CBP(Q)==CBP(E))+(CBP(Q)==CBP(F))+(CBP(Q)==CBP(G))+(CBP(Q)==CBP(H))  Eq(10)

Where a macroblock adjacent to a coding target macroblock is one codedin the intra 16×16 coding mode, all the CBPs for the luma component ofthe macroblock coded in the intra 16×16 coding mode are assumed to bethe same value as the CBPY of the macroblock coded in the intra 16×16coding mode, and coding is carried out by a method similar to that inthe application to MPEG-4 in the first embodiment of the presentinvention. Namely, for example, where the coding mode of the macroblockadjacent left to the coding target macroblock is the intra 16×16 codingmode and where the CBPY there of is “1,” the spatial context isgenerated while assuming that the CBP(G) and CBP(H), which are thevalues of CBPs of block G and block H in FIG. 8, both are “1.”

Since the configuration of CBPC is common to all the coding modes, thereis no need for an exceptional process in the encoding method. As shownin FIG. 17B, let a block of a chroma component image in a coding targetmacroblock be block I, a block adjacent above be J, and block adjacentleft be K. FIGS. 18C and 18D show a map table and a variable-lengthcoding table in the coding of CBPC in the application to H.26L. In theapplication to H.26L, the CBPC can take one of the values “0,” “1,” and“2.” Since this value is considered to resemble values of CBPC inneighboring blocks, the spatial context is generated so as to estimatethe value of CBPC of block I from the values of CBPC of block J andblock K. Namely, letting CBPC(J) represent the value of CBPC in block Jand CBPC(K) represent the value of CBPC in block K, the P(CBPC) iscalculated by Eq (11) below and the map table is switched to one whereinthe index values are assigned in increasing order from the value of CBPCclosest to the P(CBPC).P(CBPC)=(CBPC(K)+CBPC(J))/2  Eq (11)

Namely, for example, where CBPC(J)=CBPC(K)=2, Eq (11) yields P(CBPC)=2and thus the map table is generated so that the index value for CBPC=2becomes the smallest among the CBPCs in the coding target macroblock andthe index values thereafter increase in order for CBPC=1 and finally forCBPC=0, as shown in the table in FIG. 19.

By the configuration as described above, the switching of the map tablecan also be implemented in the H.26L encoding system on the basis of thespatial context, while applying the information in the neighboringblocks to the coding target macroblock to the coding of CBPs, and shortcodewords can be assigned to symbols with high occurrence probabilities,which can implement suitable coding of CBPs.

Second Embodiment

The first embodiment of the present invention presented the method ofimplementing the suitable coding of CBPs by the configuration whereinthe spatial context was generated by making use of the information ofCBPs in the neighboring blocks in the coding of CBPs and wherein the maptable was switched on the basis of the spatial context, whereas theencoding method and apparatus in the second embodiment of the presentinvention are characterized in that the coding efficiency is increasedby generating the spatial context while further utilizing the codingmode information in the neighboring blocks and implementing theswitching of the map table based thereon in the coding of CBPs.

The encoding and decoding in the second embodiment of the presentinvention will be described based on the MPEG-4 encoding system, asdescribed in the first embodiment of the present invention. The firstembodiment of the present invention employed the configuration whereinthe spatial context was generated by making use of the values of CBPs inthe neighboring blocks in the coding of CBPs of the coding targetmacroblock and wherein the map table of CBPs was switched according tothe spatial context, whereas the second embodiment of the presentinvention further utilizes the coding mode information in theneighboring macroblocks in the generation of the spatial context.

As previously described, the coding modes of macroblocks in MPEG-4consist of two inter coding modes and one intra coding mode. Among theinter coding modes the inter coding mode 1 characterized by use of fourmotion vectors is considered to be selected because of the differenceamong motions of respective blocks in a macroblock, and it is consideredin this case that the motions are not monotonic and nonzero orthogonaltransform coefficients are likely to appear. Therefore, in the case ofthe CBPs of the neighboring blocks to the coding target macroblock asshown in FIG. 8, if a macroblock to which neighboring blocks belong iscoded in the inter coding mode 1, the spatial context is generated byadopting CBP=1, regardless of actual CBP values. This configurationenables setting of a map table reflecting the fact that nonzeroorthogonal transform coefficients are likely to appear because ofcomplexity of motion in the neighboring region in the inter coding mode1 considered to indicate complex motion, thereby increasing the codingefficiency of CBPs.

The coded data coded by the above method can be suitably decoded bysetting the map table by means similar to the above on the occasion ofdecoding.

The encoding method in the second embodiment of the present inventionwas described above in the configuration wherein the spatial context wasgenerated according to the coding mode in the neighboring macroblocks tothe coding target macroblock, but it is a matter of course that thespatial context can be generated by also referring to the coding mode inthe coding target macroblock.

Third Embodiment

The encoding method in the third embodiment of the present invention ischaracterized in that in the coding of CBPs the variable-length codingtable is switched according to a distribution of probabilities ofoccurrence of respective patterns of CBPs. Namely, as shown in FIGS. 20Aand 20B, there are cases where rates of occurrence of symbols differdepending upon images, against the index order of CBPY, for example.FIG. 20A is a table showing a case where some upper index values havehigh occurrence probabilities and the others low occurrenceprobabilities. FIG. 20B is a table showing a case where the deviation isnot too large among the occurrence probabilities against index values.In such cases demonstrating distributions of occurrence rates withdifferent characteristics, it is feasible to further increase the codingefficiency by switching among variable-length coding tables suitable forthe respective characteristics.

For example, there are prepared a plurality of variable-length codingtables as shown in FIGS. 21A to 21C, and a control is made so as toadaptively switch among them. An example is a plurality ofvariable-length coding tables shown in FIGS. 21A-21C, which are calledthe exp-Golomb codes and which are configured as follows. Namely, thecodes are configured by adding the Binary part of k+j bits to the Unarypart of j+1 bits (j=0, 1, . . . ). Namely, j equals the number of “0” inthe Binary part at a certain code and k a code length of the Binary partat the zeroth code. FIG. 21A shows the exp-Golomb codes in the case ofk=0, FIG. 21B those in the case of k=1, and FIG. 21C those in the caseof k=2. As apparent from the figures, the deviation of distribution ofcode lengths tends to decrease as the value of k increases.

Now, there are prepared a plurality of variable-length coding tableswith different characteristics of deviation of distribution of codelengths in this way and adaptive switching is made among these. A methodof switching among these variable-length coding tables is as follows.For example, where the quantization parameter is large, a nonzeroorthogonal transform coefficient is unlikely to appear, the CBPY witheach bit being “0” is more likely to appear, and it is thus easy to makea correct prediction by the spatial context. Conversely, the CBPY witheach bit being “1” is unlikely to appear, so that the prediction by thespatial context tends to be off. Where the quantization parameter issmall, a nonzero orthogonal transform coefficient is likely to appear,the CBPY with each bit being “1” is more likely to appear, and theprediction by the spatial context tends to be correct. Conversely, theCBPY with each bit being “0” is unlikely to appear, so that theprediction by the spatial context tends to be off. Where thequantization parameter is neither large nor small, the CBPY has the bitsscattered without deviation to “0” or “1,” patterns appear depending onthe bits, and the prediction by the spatial context also tends to beoff. Then the control can be made with reference to the value of thequantization parameter of the coding target macroblock so that, forexample, the table of FIG. 21A is applied to the case where thequantization parameter is greater than a predetermined threshold Th1,for example, the table of FIG. 21C is applied to the case where thequantization parameter is not more than the threshold Th1 and is largerthan a threshold Th2, and the table of FIG. 21A to the case where thequantization parameter is smaller than the threshold Th2; whereby it isfeasible to provide the variable-length coding tables suitable for therespective cases and thereby implement the variable-length coding withhigh coding efficiency.

Another example of the switching method among the variable-length codingtables is to count the number of occurrences of actual CBPYs accordingto index values of CBPYs. Namely, where C(n) represents a counter ofoccurrence frequencies according to index values of the respective CBPYs(n=1-15), the control is made so as to apply, for example, the table ofFIG. 21C to the case where the variance of C′(n) resulting fromnormalization of C(n) is smaller than a preset threshold Th3, and apply,for example, the table of FIG. 21A to the case where the variance is notless than the threshold Th3; whereby it is feasible to provide thevariable-length coding tables suitable for the respective cases andthereby implement the variable-length coding with high codingefficiency.

The encoding method above was described using the three variable-lengthcoding tables in FIGS. 21A-21C, but it is a matter of course that thenumber and values of variable-length coding tables are not limited toFIGS. 21A-21C. The switching among the variable-length coding tables canbe implemented by holding the variable-length coding tables in a memory,and another potential method is that the switching among thevariable-length coding tables is implemented by using the Universalcodes, such as the exp-Golomb codes exemplified above, and switching aparameter thereof.

Specifically, in the variable-length encoder 16 of FIG. 13, the CBPs arefirst fed as input symbols H1 into variable-length code output part 30.Then coded symbol memory 31 feeds the CBPs in the neighboring blocks asvariable-length coding table reference information H2 to coding maptable provider 32. Then coding map table provider 32 determines a codingmap table to be used in the coding of the CBPs, for example, on thebasis of the technique described in the first embodiment of the presentinvention, and provides the coding table H4 to variable-length codeoutput part 30. Coded symbol memory 31 also feeds the quantizationparameter of the coding target macroblock as variable-length codingtable reference information H3 to variable-length coding table provider33. Then the variable-length coding table provider 33 determines avariable-length coding table to be used for the coding of the CBPs, onthe basis of the technique in the third embodiment of the presentinvention, and supplies the variable-length coding table H5 tovariable-length code output part 30. Then the coding target CBPs arevariable-length coded to be outputted as coded data D9.

Similarly, in the block diagram of variable-length decoder 21 shown inFIG. 14, when coded data D9 coded by the encoding method in the thirdembodiment of the present invention is fed into decoded symbol outputpart 40 of variable-length decoder 21, decoded symbol memory 41 feedsthe quantization parameter of the decoding target macroblock from thesymbols previously decoded, as decoding map table reference informationH7 into decoding map table provider 42. Then decoding map table provider42 selects a decoding map table H9 by procedure similar to the codingand feeds it to decoded symbol output part 40. Decoded symbol memory 41also feeds the CBPs in the neighboring blocks previously decoded, nextto the decoding target macroblock, as variable-length decoding tablereference information H8 into variable-length decoding table provider43. Then variable-length decoding table provider 43 selects avariable-length decoding table by procedure similar to the coding andfeeds it as variable-length decoding table H10 into decoded symboloutput part 40. Then decoded symbol output part 40 performs thevariable-length decoding to decode the CBPs as decoded symbols H6 andoutput them, and simultaneously stores them into decoded symbol memory41.

The encoding method in the third embodiment of the present invention wasconfigured to switch among the variable-length coding tables on thebasis of the quantization parameter in the coding target macroblock, butit is a matter of course that the present invention can also be appliedby similar means, using any information as long as it is codinginformation that affects the complexity of the image to be coded in thecoding target macroblock. For example, where the macroblock coding modeis a mode in which a macroblock is divided into finer blocks, the imageis considered to have higher degree of complexity. Conversely, withdecrease in the number of divided blocks, the image is considered tohave lower degree of complexity. Therefore, in the case where the imageis considered to have high-degree of complexity on the basis of themacroblock coding mode, nonzero quantized orthogonal transformcoefficients are likely to occur and it is considered that all CBPpatterns can occur; therefore, the control is made so as to implementthe coding using a variable-length coding table with smaller deviationof code lengths as a variable-length coding table for the coding ofCBPs. Conversely, in the case where the image is considered to have lowdegree of complexity, the control is made so as to implement the codingusing a variable-length coding table with larger deviation of codelengths as a variable-length coding table for the coding of CBPs. Forexample, concerning motion vectors, the possibility of complexity of theimage to be coded tends to become higher with increase in the length ofthe motion vector. For this reason, the encoding method may also beconfigured so as to perform the control to use a variable-length codingtable with smaller deviation of code lengths with increase in the lengthof the motion vector in the macroblock. In the case of the encodingsystem of predicting a motion vector of the coding target block frommotion vectors in the neighboring blocks and coding a difference valuebetween a predicted value and an actual motion vector, it is alsopossible to adopt a configuration wherein the variable-length codingtable is switched to another on the basis of the motion vectordifference value in the coding target macroblock. Namely, as the motionvector difference value increases, the motion becomes more complex inthe neighborhood of the coding target macroblock, and as a result it canbe inferred that nonzero quantized orthogonal transform coefficients arelikely to occur; in this case, the control may be configured to use avariable-length coding table with smaller deviation of code lengths, forexample, with increasing absolute value of the difference motion vectorin the coding target macroblock.

As described above, the third embodiment of the present inventionemploys the configuration wherein the switching among variable-lengthcoding tables is implemented according to the distribution of occurrenceprobabilities of the respective CBPs, and thus it can achieve efficientcoding.

Fourth Embodiment

Described next is the procedure of variable-length coding of orthogonaltransform coefficients in the encoding method according to the fourthembodiment of the present invention. The description herein is based onthe assumption that the orthogonal transform to transform spatial imagedata into frequency image data is Discrete Cosine Transform (DCT). FIG.22A shows a specific numerical example of quantized orthogonal transformcoefficients q₁₁-q₈₈ obtained by quantizing the orthogonal transformcoefficients f₁₁-f₈₈ of 8 pixels×8 lines shown in FIG. 4B. Thevariable-length encoder of image encoding apparatus performs thevariable-length coding over such quantized orthogonal transformcoefficients according to a predetermined processing procedure togenerate coded data.

In the case of the quantized orthogonal transform coefficients q₁₁-q₈₈where the subscripts i, j of each coefficient q_(ij) represent avertical frequency and a horizontal frequency corresponding thereto,unlike the image components a₁₁-a₈₈ in the spatial image data (cf. FIG.4A), each quantized orthogonal transform coefficient, concerning themagnitude of the coefficient value thereof or the like, has a datacharacteristic dependent upon the values of the corresponding spacefrequencies. In general, in the case of natural images, large orthogonaltransform coefficient values are obtained in the low frequency regionand coefficient values decrease toward the high frequency region. Thisdistribution can be approximated by a Laplace distribution with a peakat zero. As densities of pixels in each block vary greater, the spreadof the distribution of transform coefficients is also greater and anaverage amplitude value of coefficients increases.

In the processing procedure of the variable-length coding of thequantized orthogonal transform coefficients, first, the quantizedorthogonal transform coefficients q₁₁-q₈₈ being two-dimensional data aretransformed into one-dimensional data, for example, by the zigzag scanshown in FIG. 22B. In this zigzag scan, the quantized orthogonaltransform coefficients are scanned to yield a data string from the lowfrequency region to the high frequency region as the one-dimensionaldata after the scan. This yields the one-dimensional data shown in FIG.22C, in which the quantized orthogonal transform coefficients arealigned from the low frequency region to the high frequency region.

This one-dimensional data of quantized orthogonal transform coefficientsis further transformed into data consisting of values of Level and Runshown in FIG. 22D. Here the Level indicates a coefficient level at aquantized orthogonal transform coefficient with a nonzero coefficientvalue among the plurality of quantized orthogonal transformcoefficients. The Run indicates a zero run length being the number ofdata with the coefficient value of 0 present immediately before anonzero quantized orthogonal transform coefficient.

For example, in the case of the data example of DCT coefficients shownin FIG. 22A, the sixty four DCT coefficients q₁₁-q₈₈ are sorted out,based on locations of appearance of DCT coefficients with nonzerocoefficient value, into a coefficient set S₁ consisting of coefficientq₁₁, a coefficient set S₂ consisting of coefficients q₁₂, q₂₁, acoefficient set S₃ consisting of coefficients q₃₁-q₁₃, a coefficient setS₄ consisting of coefficients q₁₄-q₃₂, a coefficient set S₅ consistingof coefficients q₄₁-q₁₅, and a coefficient set S₆ consisting ofcoefficients q₁₆-q₈₈, as shown in FIG. 22C.

For each of these coefficient sets S_(i) (i=1-6), as shown in FIG. 22D,Level value L_(i) and Run value R_(i) are determined. Specifically, thecoefficient set S₁ has L₁=q₁₁=10 and R₁=0. The coefficient set S₂ hasL₂=q₂₁=−2 and R₂=1. The coefficient set S₃ has L₃=q₁₃=2 and R₃=2. Thecoefficient set S₄ has L₄=q₃₂=−1 and R₄=2. The coefficient set S₅ hasL₅=q₁₅=1 and R₅=5. The last coefficient set S₆ is a coefficient group ofthe coefficients q₁₆-q₈₈ all having the coefficient value of 0, and thushas L₆=0 and R₆ undefined.

Nonzero coefficient count CC and Run total RT in the coding target blockare calculated from the data of Level and Run shown in FIG. 22D. Forexample, specifically, they are calculated as nonzero coefficient countCC=5 and Run total RT=10 from FIG. 22D.

For example, the same as the table shown in FIG. 9B can be used as avariable-length coding table to be used in the coding of thesecoefficient sets and the nonzero coefficient count CC and Run total RT.In this variable-length coding table the left column represents theindex values and the right column the variable-length codescorresponding to the index values.

FIG. 13 is an illustration showing the block diagram of variable-lengthencoder 16 according to the fourth embodiment of the present invention.The nonzero coefficient count CC and Run total RT are first fed as inputsymbols H1 into variable-length code output part 30 and variable-lengthcoding table provider 33. The variable-length coding table provider 33provides, for example, the variable-length coding table H5 as shown inFIG. 9B, as a variable-length coding table corresponding to the inputsymbols H1, for the variable-length code output part 30, and the inputsymbols H1 are encoded using the variable-length coding table H5.Namely, using a value obtained by subtracting 1 from the value ofnonzero coefficient count CC, as an index value, a correspondingvariable-length code is outputted as coded data D9. Similarly, using thevalue of Run total RT as an index value, a corresponding code isoutputted as variable-length coded data D9.

Then the coefficient sets are encoded in order from the high frequencyside. However, the coefficient set with all the coefficient values of 0is not encoded. First, the Run values R_(i) of all the coefficient setsare first fed as input symbols H1 into variable-length code output part30, and then they are encoded similarly using the variable-length codingtable and using the Run values R_(i) as indexes, to be outputted ascoded data D9.

Then the coding of Level value is carried out for all the nonzero Levelvalues in order from the high-frequency-side coefficient set.

The encoding method in the fourth embodiment of the present invention ischaracterized in that the variable-length coding table in the coding ofLevel values in a coding target block is switched according to Levelvalues in previously coded blocks in the neighborhood of the codingtarget block.

Let a block as a target for coding be block A, a block adjacent abovethereto be block B, and a block adjacent left thereto be block C, asshown in FIG. 23. It is known that in image signals nonzero orthogonaltransform coefficients are unlikely to appear in areas with small changein texture and motion and, conversely, nonzero orthogonal transformcoefficients are likely to appear in areas with large change in textureand motion. Particularly, natural images and the like often tend to havesimilar tendencies of change in texture and motion in neighboringregions. Therefore, it is possible to analogize a tendency of occurrenceof coded coefficients in a block as a target for coding, from tendenciesof occurrence of coded coefficients in neighboring blocks to the codingtarget block.

Namely, for example, if many coefficients with large Level value appearin block B and block C adjacent to block A as a coding target, theirneighboring areas are considered to demonstrate complex change intexture and motion in image signals; therefore, we can infer fromanalogy that many coefficients with large Level value also occur in thecoding target block A. Conversely, for example, if only coefficientswith small Level value appear in block B and block C adjacent to block Aas a coding target, or if no coefficient has a nonzero Level value,their neighboring areas are considered to be monotonic in texture andmotion in image signals; therefore, we can infer from analogy thatcoefficients with small Level value also tend to appear in the codingtarget block C.

Incidentally, where there appear many large Level values, it isdifficult to analogize whether a Level value is small or large;therefore, it is feasible to perform efficient coding by use of avariable-length coding table with as small a deviation of code lengthsfor the respective Level values as possible. Conversely, where the Levelvalues tend to be small, the coding can be efficiently performed by useof such a variable-length coding table as to make the code lengthsshorter for coefficients with small Level value.

Then there are prepared a plurality of variable-length coding tableswith different characteristics of the deviation of distribution of codelengths, for example, as shown in FIGS. 21A-21C, and the variable-lengthcoding table for the coding target Level values is switched to anotheraccording to the Level values in the neighboring macroblocks. Namely,the control is carried out as follows: where it is inferred that smallLevel values tend to appear in the coding target macroblock, from theLevel values in the neighboring macroblocks, the coding is performed byuse of a table with a large deviation of code lengths, as shown in FIG.21A; where it is inferred that large Level values also tend to appear,the coding is performed by use of a table with a small deviation of codelengths, as shown in FIG. 21C.

Specifically, on the occasion of coding the Level values in the block asa coding target, for example, a maximum MaxL is determined out ofabsolute values of Level values in block B and block C in FIG. 23, andis compared with preset thresholds Th7 and Th8 (Th7<Th8), and theswitching of the variable-length coding table is performed so that thevariable-length coding table of FIG. 21A is used where MaxL is smallerthan Th7, the variable-length coding table of FIG. 21B is used whereMaxL is not less than Th7 and is smaller than Th8, and thevariable-length coding table of FIG. 21C is used where MaxL is not lessthan Th8.

Namely, in the variable-length encoder 16 of FIG. 13, when the Levelvalues are fed as input symbols H1 into variable-length code output part30, coded symbol memory 31 feeds MaxL as variable-length coding tablereference information H3 into variable-length coding table provider 33and the variable-length coding table provider 33 provides avariable-length coding table H5 which is selected by the aforementionedcontrol technique on the basis of the variable-length coding tablereference information H3, for the variable-length code output part 30.The other operation is similar to that in the first to third embodimentsof the present invention.

By adopting this configuration, the tendency of appearance of Levelvalues in the block as a coding target can be analogized from theneighboring blocks to the coding target block; short code lengths can beassigned to small Level values in the case where small Level values arelikely to appear; not too long code lengths can also be assigned tolarge Level values in the case where it is difficult to analogizewhether the Level values are small or large; therefore, it is feasibleto perform efficient coding of Level values.

The encoding method in the fourth embodiment of the present inventionwas described in the configuration wherein MaxL out of the absolutevalues of Level values in block B and block C in the neighborhood to thecoding target block was used as variable-length coding table referenceinformation H3, but it is a matter of course that the present inventionis by no means intended to be limited to this example and that, forexample, the maximum can be selected from absolute values of Levelvalues in the reference range also including other previously codedneighboring blocks or the maximum can be replaced by any otherinformation selected from a variety of information items that indicatethe characteristic of Level values in the neighboring blocks, such as anintermediate value, a total of absolute values, a variance, an averageof absolute values, and so on.

The encoding method in the fourth embodiment of the present inventionwas described so that the coding of Run values was carried out beforethat of the Level values, but it is a matter of course that the presentinvention may be arranged so that the Run values are encoded after theLevel values or so that the Run values and Level values are alternatelyencoded.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the fourth embodiment of the present invention.When coded data D9 coded by the encoding method in the fourth embodimentof the present invention is fed into decoded symbol output part 40 ofvariable-length decoder 21, the decoded symbol memory 41 feeds MaxL intovariable-length decoding table provider 43. Then variable-lengthdecoding table provider 43 determines a variable-length decoding tableused for the target, by the processing similar to that in the coding andsupplies the variable-length decoding table H9 to decoded symbol outputpart 40. The decoded symbol output part 40 then performs thevariable-length decoding to decode and output the Level values asdecoded symbols H6, and simultaneously stores them into decoded symbolmemory 41.

Since the variable-length decoder is configured as described above, itis feasible to properly decode the coded data coded by the encodingmethod in the fourth embodiment of the present invention.

The encoding method and decoding method in the fourth embodiment of thepresent invention were described above using the specific table values,but it is a matter of course that the present invention is by no meansintended to be limited to these values. The embodiment of the presentinvention was described using the example of DCT coefficients of 8pixels×8 lines, but it is needless to mention that the type of theorthogonal transform and the size of blocks are not limited to these.

Fifth Embodiment

The encoding method in the fifth embodiment of the present inventionwill be described below. Now, the motion vector information D2 is givenas follows: for example, in the coding in MPEG-4, an intermediate valueof motion vectors in neighboring macroblocks is generated as a predictedvalue, for a motion vector in a macroblock as a target for coding, and adifference MVD between the predicted value and the actual motion vectoris encoded.

Here, as shown in FIG. 23, let a macroblock as a coding target bemacroblock A, a block adjacent above thereto be macroblock B, and blockadjacent left thereto be macroblock C. In image signals, particularly,natural images and the like often tend to have a similar tendency ofchange in texture and motion in a certain area to those in neighboringareas. Therefore, where the change of motion is great in neighboringmacroblocks to a macroblock as a coding target, the change of motion isalso great in the coding target macroblock and it is difficult toanalogize what is the absolute value of the motion vector difference.Conversely, where the change of motion is small in neighboringmacroblocks, we can infer that it is highly possible that theneighboring areas contain monotonic motion or are at a standstill, andthus we can infer from analogy that the absolute value of the motionvector difference in the coding target macroblock also takes a smallvalue.

Therefore, where the absolute values of motion vector differences aresmall in the neighboring macroblocks to the coding target macroblock, itis highly possible that the absolute value of the motion vectordifference of the coding target converges in the vicinity of 0, and thusthe coding can be performed efficiently by use of a variable-lengthcoding table with short code lengths in the vicinity of 0. Conversely,where the absolute values of motion vector differences are large in theneighboring macroblocks to the coding target macroblock, the absolutevalue of the motion vector difference of the coding target does notalways converge in the vicinity of 0. Therefore, in this case, thecoding can be performed efficiently by use of a variable-length codingtable with not too large difference is code lengths, regardless ofwhether the absolute value of the motion vector difference is large orsmall.

Keeping these in mind, the fifth embodiment of the present inventioncomprises preparing a plurality of variable-length coding tables withdifferent characteristics of deviation of distribution of code lengths,for example, as shown in FIGS. 21A-21C, and implementing switching ofthe variable-length coding table for the motion vector difference in thecoding target macroblock, in accordance with magnitudes of absolutevalues of motion vector differences in neighboring macroblocks to thecoding target macroblock.

Specifically, let us define MVD(B) and MVD(C) as absolute values ofmotion vector differences in macroblock B adjacent above and macroblockC adjacent left as neighboring macroblocks to the coding targetmacroblock A, for example, as shown in FIG. 23. With respect to a presetthreshold Th0, the variable-length coding is carried out as follows: ifMVD(B) and MVD(C) both are smaller than Th0, the variable-length codingis carried out using the table of FIG. 21A as a variable-length codingtable for the motion vector difference in macroblock A; if only eitherMVD(B) or MVD(A) is equal to Th0 or larger than Th0, the variable-lengthcoding is carried out using the table of FIG. 21B; if MVD(B) and MVD(C)both are equal to Th0 or larger than Th0, the variable-length coding iscarried out using the table of FIG. 21C. However, where macroblock B ormacroblock C is outside the screen or outside a given slice, theprocessing is carried out on the assumption that the absolute value ofthe motion vector difference of that macroblock is a preset value Z(Z≧Th0). The reason for this is that when an adjacent macroblock isoutside the screen or outside the slice, it is difficult to make acorrect predicted value of the motion vector and possible values of themotion vector difference of the coding target do not always converge inthe vicinity of 0. Where an adjacent macroblock is an intra macroblock,the processing is carried out similarly on the assumption that theabsolute value of the motion vector difference of the macroblock is Z.The reason for this is also that it is difficult to make a correctpredicted value of the motion vector of the coding target, just as inthe above case, and possible values of the motion vector difference ofthe coding target do not always-converge in the vicinity of 0.

Namely, in the variable-length encoder 16 of FIG. 13 the motion vectordifference MVD is first fed as an input symbol H1 into thevariable-length code output part 30. Then coded symbol memory 31 feedsMVD(B) and MVD(C) as variable-length coding table reference informationH3 into variable-length coding table provider 33. Then thevariable-length coding table provider 33 compares MVD(B) and MVD(C) withthe preset threshold Th0 as described above, determines avariable-length coding table to be used for the coding target motionvector, on the basis thereof, and provides the variable-length codingtable H5 for the variable-length code output part 30. Then the codingtarget motion vector is variable-length coded to be outputted as codeddata D9.

In the encoding method according to the fifth embodiment of the presentinvention, where the MVD value tends to converge around 0 as describedabove, the variable-length coding table is switched to one with shortcode lengths near 0 to make such a control as to decrease the codelengths in the case of the MVD value being in the vicinity of 0; wherethe MVD value does not always converge around 0, the variable-lengthcoding table is switched to a table with small deviation of code lengthsto prevent the code lengths from becoming long even if the MVD value islarge; therefore, it is feasible to efficiently encode the MVD value.

The encoding method was described using the three variable-length codingtables in FIGS. 21A-21C, but it is a matter of course that the numberand values of variable-length coding tables are not limited to those inFIGS. 21A-21C. The switching among the tables may also be implemented insuch a way that a plurality of variable-length coding tables areretained in a memory in variable-length coding table provider 33 and theprovision of variable-length coding table H3 is switched among them, orin such a way that the Universal codes such as the exp-Golomb codes asexemplified are used and a parameter thereof is switched to generate thevariable-length coding table H3 in variable-length coding table provider33.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the fifth embodiment of the present invention.When coded data D9 coded by the encoding method according to the fifthembodiment of the present invention is fed into decoded symbol outputpart 40 of variable-length decoder 21, decoded symbol memory 41 feedsMVD(B) and MVD(C) calculated from the previously decoded symbols, asvariable-length decoding table reference information H8 into thevariable-length decoding table provider 43. Then the variable-lengthdecoding table provider 43 selects a variable-length decoding table H10by procedure similar to the coding and feeds it to decoded symbol outputpart 40. Then decoded symbol output part 40 performs the variable-lengthdecoding to decode and output the MVD value as a decoded symbol H6, andsimultaneously stores it into decoded symbol memory 41.

Since the variable-length decoder is configured as described above, thecoded data coded by the encoding method in the fifth embodiment of thepresent invention can be suitably decoded.

Sixth Embodiment

The encoding method in the fifth embodiment of the present invention wasconfigured to switch the variable-length coding table according to themotion vectors in macroblocks around a macroblock as a coding target,whereas the encoding method in the sixth embodiment of the presentinvention is characterized in that the variable-length coding table isswitched according to macroblock coding modes in macroblocks around amacroblock as a coding target.

As previously shown in FIGS. 3A to 3C, for example, MPEG-4 has the threeclasses of coding modes of macroblocks, the inter coding mode 0, theinter coding mode 1, and the intra coding mode. Incidentally, the intercoding mode 1 is a coding mode in which the motion compensation is mademore effectively using four motion vectors where the motion in thescreen is complex than in the inter coding mode 0. Therefore, we caninfer that the motion in the screen in a macroblock for which the intercoding mode 1 is selected is more complex than that in a macroblock forwhich the inter coding mode 0 is selected. In the encoding methodaccording to the second embodiment of the present invention, therefore,point P(MB) indicating complexity is defined according to each codingmode for an arbitrary macroblock MB, as shown in FIG. 25. Let pointsP(B) and P(C) calculated for macroblocks B and C shown in FIG. 8, whichare adjacent to a macroblock as a coding target, according to thedefinition. Then a point for macroblock A as a coding target is definedby Eq (12) below.P(A)=P(B)+P(C)  Eq (12)

Now, the point P(A) calculated as described above represents thecomplexity of motion in the screen in the macroblocks adjacent to themacroblock as a coding, target and, the difficulty of prediction of themotion vector in the macroblock as a coding target from the adjacentmacroblocks. The larger the point, the harder the prediction, or themore complex the motion.

Therefore, there are prepared a plurality of variable-length codingtables with different characteristics of deviation of distribution ofcode lengths as shown in FIGS. 21A-21C, and the variable-length codingtable for the motion vector difference value in the coding targetmacroblock is switched according to the magnitude of the point P(A)calculated from the macroblock coding modes in the neighboringmacroblocks to the coding target macroblock.

Specifically, for example, with respect to preset thresholds Th1 and Th2(Th1<Th2), we can infer that if point P(A) is smaller than Th1, themotion is not complex and the motion vector predicted value tends to becorrect, and thus the variable-length coding is carried out using thetable of FIG. 21A configured so that codes for motion vectors with theirabsolute value closer to 0 have shorter code lengths. Similarly, if P(A)is not less than Th1 and is smaller than Th2, the variable-length codingis carried out using the table of FIG. 21B; if P(A) is not less thanTh2, the variable-length coding is carried out using the table of FIG.21C. However, where the macroblock B or macroblock C is outside thescreen or outside a given slice, the point P(X) of that macroblock(where X is B or C) is assumed to be the same point as that for theintra coding mode (with AC coefficients). The reason for it is that whenan adjacent macroblock is outside the screen or outside the slice, thepredicted value of motion vector is unlikely to be correct and possiblevalues of the motion vector difference of the coding target do notalways converge around 0.

Namely, in the variable-length encoder 16 of FIG. 13 the motion vectordifference MVD is first fed as an input symbol H1 into variable-lengthcode output part 30. Then coded symbol memory 31 feeds the coding modeinformation of macroblock B and macroblock C as variable-length codingtable reference information H3 into variable-length coding tableprovider 33. Thereafter, variable-length coding table provider 33calculates the point P(A) as described above, compares it with thepreset thresholds Th1 and Th2, determines a variable-length coding tableto be used for the coding target motion vector, on the basis thereof,and provides the variable-length coding table H5 for the variable-lengthcode output part 30. Then the coding target motion vector isvariable-length coded to be outputted as coded data D9.

In the encoding method according to the sixth embodiment of the presentinvention, where the MVD value tends to converge around 0 by analogyfrom the macroblock coding modes in the macroblocks around themacroblock as a coding target as described above, the variable-lengthcoding table is switched to one with short code lengths around 0 to makesuch a control as to decrease the code lengths in the case of the MVDvalue being around 0; where the MVD value does not always tend toconverge around 0, the variable-length coding table is switched to atable with small deviation of code lengths to prevent the code lengthsfrom becoming long even if the MVD value is large; therefore, it isfeasible to implement efficient coding of the MVD value.

The encoding method was described using the three variable-length codingtables in FIGS. 21A-21C, but it is a matter of course that the numberand values of variable-length coding tables are not limited to those inFIGS. 21A-21C. The switching among the tables may also be implemented insuch a way that a plurality of variable-length coding tables areretained in a memory in variable-length coding table provider 33 and theprovision of variable-length coding table H5 is switched among them, orin such a way that the Universal codes such as the exp-Golomb codes asexemplified are used and a parameter thereof is switched to generate thevariable-length coding table H5 in variable-length coding table provider33.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the sixth embodiment of the present invention.When coded data D9 coded by the encoding method in the sixth embodimentof the present invention is fed into decoded symbol output part 40 ofvariable-length decoder 21, decoded symbol memory 41 feeds themacroblock coding modes in the macroblocks B and C adjacent to themacroblock as a coding target, which are determined from the previouslydecoded symbols, as variable-length decoding table reference informationH8 into variable-length decoding table provider 43. Then variable-lengthdecoding table provider 43 selects a variable-length decoding table H10by procedure similar to the coding and feeds it to decoded symbol outputpart 40. Thereafter, decoded symbol output part 40 performs thevariable-length decoding to decode and output the MVD value as a decodedsymbol H6, and simultaneously stores it into decoded symbol memory 41.

Since the variable-length decoder is configured as described above, itis feasible to suitably decode the coded data coded by the encodingmethod according to the sixth embodiment of the present invention.

The sixth embodiment of the present invention described the preferredencoding method and decoding method of the motion vector differenceusing the macroblock coding modes by the use of the example ofapplication to MPEG-4, but it is noted that the encoding method is notlimited to this example, of course. An example described below is anencoding method in which the invention is applied to the H.26L encodingsystem.

In the H.26L encoding system, the macroblock coding modes prepared areten coding modes including one skip (Skip) mode 0, seven inter modes1-7, and two intra modes 8, 9 as shown in FIGS. 24A-24J.

Among these, the skip mode 0 is a mode that is used where no motion ofimage is detected, and mode of copying an image at the same location ina reference frame used for the motion compensation.

The inter modes 1-7 are modes where the interframe coding (codingbetween frames) is carried out using their respective blocksegmentations different from each other. The motion compensation blocksin the respective modes are defined as shown in FIGS. 24A-24J: mode 1 isa mode using one block in the size of 16 pixels×16 lines. Mode 2 is amode using two blocks in the size of 16 pixels×8 lines. Mode 3 is a modeusing two blocks in the size of 8 pixels×16 lines. Mode 4 is a modeusing four blocks in the size of 8 pixels×8 lines. Mode 5 is a modeusing eight blocks in the size of 8 pixels×4 lines. Mode 6 is a modeusing eight blocks in the size of 4 pixels×8 lines. Mode 7 is a modeusing sixteen blocks in the size of 4 pixels×4 lines. FIG. 28A shows amap table indicating a correspondence between these modes and indexvalues, and FIG. 28B a variable-length coding table indicating codescorresponding to the respective index values.

Intra modes 8, 9 are modes where the intraframe coding (codingwithin-frame) is carried out using their respective block segmentationsdifferent from each other. The blocks in the respective modes aredefined as shown in FIGS. 24A-24J: mode 8 is a mode using sixteen blocksin the size of 4 pixels×4 pixels. Mode 9 is a mode using one block inthe size of 16×16.

Now, for these ten coding modes, let us define points P in much the samemanner as in the example of application to MPEG-4. For example, thepoints are defined as shown in FIG. 27. Namely, since we can infer thatthe motion becomes more complex with increase in the number of blocksegments in the inter coding modes, the points are defined so as tobecome larger with increase in the number of block segments. Since theskip mode is considered to contain no motion, we can infer that themotion in the neighborhood is often null or small as well, and thus thepoint is defined so as to take a small value. It is also expected in theintra coding modes that the motion becomes more complex with increase inthe number of block segments, so as to make it harder to make a rightprediction of motion vector in the coding target macroblock and thatwhere the number of block segments is small, the motion can be not socomplex but the prediction of motion vector tends to be off. Therefore,in mode 8 the point is defined to take a large value and in mode 9 thepoint is defined to take a smaller value than in mode 8. It is notedthat these values are presented just as an example for easierunderstanding of the description and the present invention is by nomeans intended to be limited to these specific values in the table.

Now, using the table of points for the coding modes in FIG. 27, thepoints P(B) and P(C) of macroblocks B and C adjacent to the macroblockas a coding target are calculated in much the same manner as in theexample of application to MPEG-4. Then the point P(A) for the codingtarget macroblock is determined from P(B) and P(C).

Thereafter, P(A) is compared with the thresholds in similar manner, andthe variable-length coding table is switched according to the result ofthe comparison, thus enabling the application of the present inventionto the H.26L encoding system.

Seventh Embodiment

Described next is the encoding method according to the seventhembodiment of the present invention. Now, the macroblock coding modes,for example, in MPEG-4, as previously shown in FIGS. 3A-3C, areclassified under the three coding modes of macroblocks, the inter codingmode 0, the inter coding mode 1, and the intra coding mode.Incidentally, the inter coding mode 1 is a coding mode of performing themotion compensation using four motion vectors more effectively where themotion in the screen is complex or where the texture is complex, than inthe inter coding mode 0. Therefore, we can infer that the motion andtexture in the screen in a macroblock for which the inter coding mode 1is selected are more complex than in a macroblock for which the intercoding mode 0 is selected. It is also considered as to the intra codingmode that the texture becomes more complex with increase in the numberof nonzero coefficients in a macroblock and, conversely, the texturebecomes more monotonic with decrease in the number of nonzerocoefficients.

Here, as shown in FIG. 23, let a macroblock as a coding target be amacroblock A, a block adjacent above thereto be a macroblock B, and ablock adjacent left thereto be a macroblock C. In image signals,particularly, in the case of natural images and the like, it is oftenthe case that a tendency of change in texture and motion in a certainarea is similar to those in neighboring areas. Therefore, where themotion and texture are complex in neighboring macroblocks to amacroblock as a coding target, we can infer that the motion and texturealso become complex in the coding target macroblock. Conversely, wherethe motion and texture are monotonic in the neighboring macroblocks, wecan infer that the motion and texture are also monotonic in the codingtarget macroblock.

It follows that we can analogize a coding mode likely to appear in thecoding target macroblock, from the information of the macroblock codingmodes or the like in the neighboring macroblocks to the coding targetmacroblock.

In the encoding method according to the seventh embodiment of thepresent invention, therefore, for an arbitrary macroblock MB, pointP(MB) indicating complexity is defined according to each coding mode asshown in FIG. 25. For the intra coding mode, however, different pointsare defined depending upon whether there are AC components among theorthogonal transform coefficients of luma component.

Points P(B) and P(C) are defined as points calculated for macroblocks Band C shown in FIG. 23, adjacent to the coding target macroblock throughapplication of the definition. Then a point for the coding targetmacroblock A is defined by Eq (13) below.P(A)=(P(B)+P(C))/2  Eq (13)

Now, the point P(A) calculated as described above indicates thecomplexity of motion and texture in the macroblocks adjacent to thecoding target macroblock. The larger the point, the more complex themotion and texture.

Therefore, a map table is prepared as shown in FIG. 26A and avariable-length coding table as shown in FIG. 26B. The map table isswitched according to the magnitude of point P(A) calculated from themacroblock coding modes in the neighboring macroblocks to the codingtarget macroblock so as to change assignment of codewords in thevariable-length coding of the macroblock coding mode in the codingtarget macroblock. However, since two points are calculated for an intramacroblock, the smaller is adopted.

Specifically, the map table is switched as follows: for example, adifference DP is calculated between the calculated point P(A) and apoint defined for each coding mode and index values in the map table arearranged in increasing order from the smallest corresponding toincreasing order of DP values of the coding modes.

Namely, in the variable-length encoder 16 of FIG. 13 a macroblock codingmode is first fed as an input symbol H1 into variable-length code outputpart 30. Then coded symbol memory 31 feeds the coding mode informationand CBPs of macroblocks B and C as coding map table referenceinformation H2 to coding map table provider 32. Then coding map tableprovider 32 calculates the point P(A) as described above, determines acoding map table on the basis thereof, and provides the coding map tableH4 for variable-length code output part 30. The variable-length codingtable provider 33 also provides a variable-length coding table H5 forvariable-length code output part 30. Then the macroblock coding mode isvariable-length coded to be outputted as coded data D9.

Since the encoding method in the seventh embodiment of the presentinvention is configured to switch the map table so as to encode amacroblock coding mode analogized to be likely to appear, by a shortercode length as described above, it can efficiently encode the macroblockcoding mode.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the seventh embodiment of the present invention.When coded data D9 coded by the encoding method in the seventhembodiment of the present invention is fed into decoded symbol outputpart 40 of variable-length decoder 21, decoded symbol memory 41 feedsthe macroblock coding modes and CBPs in the macroblocks B and C beingpreviously decoded symbols, as decoding map table reference informationH7 into decoding map table provider 42. Then decoding map table provider42 selects a decoding map table H9 by procedure similar to the codingand feeds it into decoded symbol output part 40. Variable-lengthdecoding table provider 43 also feeds a variable-length decoding tableH10 into decoded symbol output part 40. Then the decoded symbol outputpart 40 performs the variable-length decoding to decode and output thecoding mode as a decoded symbol H6, and simultaneously stores it intodecoded symbol memory 41.

Since the variable-length decoder is configured as described above, itis feasible to suitably decode the coded data coded by the encodingmethod in the seventh embodiment of the present invention.

The seventh embodiment of the present invention described the preferredencoding method and decoding method of the macroblock coding modeutilizing the coding information in the neighboring macroblocks aroundthe coding target macroblock by the use of the example of application toMPEG-4, but it is a matter of course that the encoding method is notlimited to this example. An example described below is an encodingmethod as an example of application to the H.26L encoding system.

In the H.26L encoding system, the macroblock coding modes prepared areten coding modes including one skip (Skip) mode 0, seven inter modes1-7, and two intra modes 8, 9 as shown in FIGS. 24A-24J.

Among these, the skip mode 0 is a mode that is used where no motion ofimage is detected, and mode of copying an image at the same location ina reference frame used for the motion compensation.

The inter modes 1-7 are modes where the interframe coding (codingbetween frames) is carried out using their respective blocksegmentations different from each other. The motion compensation blocksin the respective modes are defined as shown in FIGS. 24A-24J: mode 1 isa mode using one block in the size of 16 pixels×16 lines. Mode 2 is amode using two blocks in the size of 16 pixels×8 lines. Mode 3 is a modeusing two blocks in the size of 8 pixels×16 lines. Mode 4 is a modeusing four blocks in the size of 8 pixels×8 lines. Mode 5 is a modeusing eight blocks in the size of 8 pixels×4 lines. Mode 6 is a modeusing eight blocks in the size of 4 pixels×8 lines. Mode 7 is a modeusing sixteen blocks in the size of 4 pixels×4 lines.

Intra modes 8, 9 are modes where the intraframe coding (coding withinframe) is carried out using their respective block segmentationsdifferent from each other. The blocks in the respective modes aredefined as shown in FIGS. 24A-24J: mode 8 is a mode using sixteen blocksin the size of 4 pixels×4 pixels. Mode 9 is a mode using one block inthe size of 16×16.

Now, for these ten coding modes, let us define points P in much the samemanner as in the example of application to MPEG-4. For example, thepoints are defined as shown in FIG. 27. Namely, since we can infer thatthe motion and texture become more complex with increase in the numberof block segments in the inter coding modes, the points are defined soas to become larger with increase in the number of block segments. Sincethe skip mode is considered to contain no motion, we can infer that themotion in the neighborhood is often null or small as well, and thus thepoint is defined so as to take a small value. It is also expected in theintra coding modes that the motion and texture become more complex withincrease in the number of block segments, so as to make it harder tomake a right prediction of motion vector in the coding target macroblockand that where the number of block segments is small, the motion andtexture can be not so complex but the prediction of motion vector tendsto be off. Therefore, in mode 8 the point is defined to take a largevalue and in mode 9 the point is defined to take a smaller value than inmode 8. It is noted that these values are presented just as an examplefor easier understanding of the description and the present invention isby no means intended to be limited to these specific values in thetable.

Now, using the table of points for the coding modes in FIG. 27, thepoints P(B) and P(C) of macroblocks B and C adjacent to the macroblockas a coding target are calculated in much the same manner as in theexample of application to MPEG-4. Then the point P(A) for the codingtarget macroblock is determined from P(B) and P(C) in accordance with Eq(13).

Thereafter, while reference is made to the value of P(A) in similarfashion, the map table is switched to one where the index values becomesmaller as a point in each coding mode becomes closer to the value ofpoint P(A), thereby enabling the application of the present invention tothe H.26L encoding system.

Eighth Embodiment

The seventh embodiment of the present invention involved the switchingof only the map table without switching of the variable-length codingtable, whereas the encoding method in the eighth embodiment of thepresent invention is characterized in that the variable-length codingtable is switched according to the coding modes in the neighboringmacroblocks to the coding target macroblock, so as to implement moreefficient coding.

Now, where coding modes indicating complexity of the same level areselected in the macroblocks B and C adjacent to the macroblock A as acoding target previously shown in FIG. 23, we can infer that it ishighly possible that a coding mode indicating complexity of the samelevel as that in the macroblocks B and C is also selected in themacroblock A. However, where coding modes indicating utterly differentcomplexities are selected in the macroblocks B and C, we cannotanalogize which coding mode is selected in the macroblock A. Therefore,where degrees of complexity are similar in the coding modes selected inthe macroblocks B and C, the variable-length coding of the coding modeis carried out using a variable-length coding table with large deviationof code lengths so as to implement coding with shorter code lengths forcoding modes of smaller index values; conversely, where degrees ofcomplexity are not similar in the coding modes selected in themacroblocks B and C, the variable-length coding of the coding mode iscarried out using a variable-length coding table with small deviation ofcode lengths so as not to give a large difference between code lengthsfor the coding modes of small index values and code lengths for codingmodes of large index values; whereby it is feasible to implement theefficient variable-length coding of the coding mode.

For example, there are prepared a plurality of variable-length codingtables with different characteristics of deviation of distribution ofcode lengths as shown in FIGS. 21A-21C, and the variable-length codingtable in the coding target macroblock is switched according to themagnitude of the difference between points P(B) and P(C) in theneighboring macroblocks to the coding target macroblock.

Specifically, for example, in the application to the H.26L encodingsystem, the switching of the map table is carried out according to theseventh embodiment of the present invention and the absolute value PD iscalculated of the difference between points P(B) and P(C) determined forthe macroblocks B and C from the table in FIG. 27. Then, for example,with respect to preset thresholds Th1 and Th2 (Th1<Th2), thevariable-length coding table of FIG. 21A with large deviation of codelengths is used where PD is smaller than Th1; the variable-length codingtable of FIG. 21B is used where PD is not less than Th1 and is smallerthan Th2; the variable-length coding table of FIG. 21C with smalldeviation of code lengths is used where PD is not less than Th2; wherebyit is feasible to implement efficient coding of the macroblock codingmode.

Namely, in the variable-length encoder 16 of FIG. 13 a macroblock codingmode is first fed as an input symbol H1 into variable-length code outputpart 30. Then coded symbol memory 31 feeds the coding mode informationof macroblock B and macroblock C as coding map table referenceinformation H2 into coding map table provider 32. Similarly, codedsymbol memory 31 also feeds the coding mode information of macroblock Band macroblock C as variable-length coding table reference informationH3 into variable-length coding table provider 33. Then coding map tableprovider 32 calculates the point P(A) as described above, determines acoding map table on the basis thereof, and provides the coding map tableH4 for variable-length code output part 30. Variable-length coding tableprovider 33 compares the absolute value PD of the difference betweenpoint P(B) and point P(C) with the preset thresholds Th1 and Th2 asdescribed above to select a variable-length coding table H5, and thenprovides it for the variable-length code output part 30. Then themacroblock coding mode is variable-length coded to be outputted as codeddata D9.

In the variable-length decoder according to the eighth embodiment of thepresent invention as shown in FIG. 14, when coded data D9 coded by theencoding method in the eighth embodiment of the present invention is fedinto decoded symbol output part 40 of variable-length decoder 21,decoded symbol memory 41 feeds the macroblock coding mode information inthe macroblocks B and C being previously decoded symbols, as decodingmap table reference information H7 to decoding map table provider 42.Similarly, decoded symbol memory 41 also feeds the macroblock codingmode information in the macroblocks B and C being the previously decodedsymbols, as variable-length decoding table reference information H8 intovariable-length decoding table provider 43. Then decoding map tableprovider 42 selects a decoding map table H9 by procedure similar to thecoding and feeds it to decoded symbol output part 40. Thevariable-length decoding table provider 43 also selects avariable-length decoding table H10 by procedure similar to the codingand feeds it to decoded symbol output part 40. Thereafter, decodedsymbol output part 40 performs the variable-length decoding to decodeand output the coding mode as a decoded symbol H6, and simultaneouslystores it into decoded symbol memory 41.

Since the variable-length decoder is configured as described above, itis feasible to properly decode the coded data coded by the encodingmethod in the eighth embodiment of the present invention.

Ninth Embodiment

The encoding methods in the first to eighth embodiments of the presentinvention were characterized by adaptively switching the coding maptable or variable-length coding table according to the context in theneighborhood, whereas the encoding method according to the ninthembodiment of the present invention is characterized by furtherinvolving learning of coding information corresponding to each indexvalue in each coding map table from the past coding result.

FIG. 30 is a block diagram showing a configuration of learningfunction-added variable-length encoder 50 according to the ninthembodiment of the present invention. In FIG. 30, the same elements as inthe variable-length encoder 16 in FIG. 13 are denoted by the samereference symbols, without redundant description thereof. In thelearning function-added variable-length encoder 50 in the ninthembodiment of the present invention, feedback function-addedvariable-length code output part 51 is characterized by further having afunction of outputting adopted index value H11 being an index valueagainst an input symbol in a coding map table, in addition to thefunction of the variable-length code output part 30 in FIG. 13.Furthermore, learning function-added coding map table provider 52 ischaracterized by further having a function of receiving the adoptedindex value H11 and updating the map table in the context against theinput symbol H1, in addition to the function of the coding map tableprovider 32 in FIG. 13.

When the input symbol H1 is fed into learning function-addedvariable-length encoder 50 according to the ninth embodiment of thepresent invention, learning function-added coding map table provider 52determines a used map table on the basis of the coding map tablereference information H2 and past learning result and provides the maptable H4 to be used, for feedback function-added variable-length codeoutput part 51. Variable-length coding table provider 33, if necessary,determines a variable-length coding table to be used, on the basis ofvariable-length coding table reference information H3, and provides thevariable-length coding table H5 to be used, for feedback function-addedvariable-length code output part 51. The feedback function-addedvariable-length code output part 51 performs the variable-length codingof the input symbol H1 using the map table and variable-length codingtable obtained in this way, outputs coded data D9, and provides theadopted index value H11 being an index value in the map tablecorresponding to the input symbol H1, for the learning function-addedcoding map table provider 52. The learning function-added coding maptable provider 52 updates the used map table on the basis of the inputadopted index value H11 and, where the same context is selected nexttime, the coding is performed using the map table updated in this way.

The update of the map table will be described below in detail with aspecific example. Here is presented an example using the coding modes ofmacroblocks in H.26L for the coding target symbol, which will bedescribed as an application to the seventh embodiment of the presentinvention.

In H.26L there are ten macroblock coding modes as shown in FIGS.24A-24J, and the example in the seventh embodiment of the presentinvention was such that the points were defined as shown in FIG. 27, thepoint P(A) was determined by Eq (13) from the points P(B) and P(C) forthe coding modes of macroblocks B and C adjacent to the coding targetmacroblock A shown in FIG. 23, and the map table was switched using thepoint P(A) as context.

It is obvious from Eq (13) that possible values of P(A) are eightintegers from 0 to 7. It is also obvious that there are eight types ofmap tables MT(CX) generated according to the values CX of P(A). FIG. 31shows the map tables MT(CX) where CX takes the values from 0 to 7. Inthe tables shown in FIG. 31, let MT(CX,M) represent an index valuecorresponding to a coding mode M in a map table MT (CX). As seen fromFIG. 31, for example, a map table MT(3, M) for P(A)=3 is configured totake the index values of 7, 2, 0, 1, 3, 4, 5, 8, 9, and 6 in order fromM=0 to M=9.

Supposing the context is P(A)=3 and the coding mode as a coding targetis mode 8, a code corresponding to the index value 9 at MT(3,8) in themap table MT(3) is outputted, for example, based on the variable-lengthcoding table shown in FIG. 9B. However, if mode 8 is selected with ahigh frequency as a coding mode with occurrence of the context P(A)=3, ashort code should be assigned to mode 8 by setting the correspondingindex value to a smaller value.

Therefore, for example, a frequency C(3,8) of selections of mode 8 inMT(3) is counted and, if the frequency becomes larger than a presetthreshold Th9, the index value MT(3,8) corresponding to mode 8 isinterchanged with MT(3,7) having a next smaller index value thanMT(3,8). The selection frequency C(3,8) corresponding to mode 8 is thenreset to 0. When the control is made in this way so as to decrease theindex value for a mode with high selection frequency and update the maptables independently of each other, it is feasible to optimize each ofthe map tables according to each context.

The update method of map tables described herein is just an example,and, by optimizing the map tables according to each context as describedabove, it is feasible to implement efficient variable-length coding moresuitable for the coding condition and the property of image.

FIG. 32 is a block diagram showing a configuration of learningfunction-added variable-length decoder 60 according to the ninthembodiment of the present invention. In FIG. 32, the same elements as inthe variable-length decoder 21 in FIG. 14 are denoted by the samereference symbols, without redundant description thereof. In thelearning function-added variable-length decoder 60 according to theninth embodiment of the present invention, feedback function-addeddecoded symbol output part 61 is characterized by further having afunction of outputting a used index value H12 being an index valueagainst an output symbol in a decoding map table, in addition to thefunction of decoded symbol output part 40 in FIG. 14. Learningfunction-added decoding map table provider 62 is characterized byfurther having a function of receiving the used index value H12 andupdating the map table in the context for the output symbol H6, inaddition to the function of decoding map table provider 42 in FIG. 14.

The process of learning in the learning function-added variable-lengthdecoder 60 in the ninth embodiment of the present invention configuredas described above is arranged to be the same as the process of learningin the ninth embodiment of the present invention, whereby it is feasibleto suitably decode the coded data coded by the encoding method in theninth embodiment of the present invention.

The ninth embodiment of the present invention described the process oflearning using the example of the macroblock coding modes in the H.26Lencoding system, but it is a matter of course that it can also beapplied to any other coding symbols without having to be limited to theexample and the preferred encoding method and decoding method can beprovided as a result is thereof.

The ninth embodiment of the present invention was described using themap table switching method in the seventh embodiment of the presentinvention, but it is a matter of course that the present invention isnot limited to it and can also be applied to any encoding method anddecoding method with means for selecting codewords to be assigned tosymbols on the basis of the context, thus providing the preferredencoding method and decoding method as a result.

Tenth Embodiment

Described next is the encoding method according to the tenth embodimentof the present invention. The encoding method in the fifth embodiment ofthe present invention was configured to switch the variable-lengthcoding table with reference to the motion vector difference values inthe neighboring macroblocks on the occasion of coding the motion vectordifference MVD of the coding target macroblock as motion vectorinformation D2, whereas the encoding method in the tenth embodiment ofthe present invention is characterized by switching the variable-lengthcoding table with reference to the motion vectors in the neighboringmacroblocks.

Namely, as described previously, the motion vector information D2 isobtained, for example in the coding in MPEG-4, in the following manner:an intermediate value of motion vectors in the neighboring macroblocksis generated as a predicted value, for a motion vector of a codingtarget macroblock, and a difference MVD between the predicted value andthe actual motion vector is coded as motion vector information D2. Wherethe motion vectors in the neighboring macroblocks take values close toeach other, the predicted value of motion vector can be considered to bea reliable value and thus the motion vector difference MVD tends toconverge near 0 with a high possibility. In this case, therefore,efficient coding can be implemented by use of a variable-length codingtable with shorter code lengths near 0. Conversely, where the motionvectors in the neighboring macroblocks take values largely differentfrom each other, the motion vector predicted value is considered to bean unreliable value, and thus the motion vector difference MVD does notalways converge near 0. In this case, therefore, efficient coding can beimplemented by use of such a variable-length coding table as not to makea large difference in code lengths, regardless of whether the absolutevalue of the motion vector difference is large or small.

Keeping these in mind, the tenth embodiment of the present inventioninvolves preparing a plurality of variable-length coding tables withdifferent characteristics of deviation of distribution of code lengths,for example, as shown in FIGS. 21A-21C, and switching among thevariable-length coding tables for the motion vector difference value inthe coding target macroblock, in accordance with the magnitude of thesum of absolute differences between motion vectors in the neighboringmacroblocks to the coding target macroblock.

Specifically, let MV(B), MV(C), and MV(D) be a motion vector in amacroblock B adjacent above, a motion vector in a macroblock C adjacentleft, and a motion vector in a macroblock D adjacent right upper asneighboring macroblocks to the coding target macroblock A as shown inFIG. 33. With respect to preset thresholds Th10, Th11 (where Th10<Th11),if a value of S=|MV(B)−MVD(C)|+|MV(C)−MV(D)| as a sum of absolutedifferences between the motion vectors is smaller than Th10, thevariable-length coding is performed using the table of FIG. 21A as avariable-length coding table for the motion vector difference in themacroblock A; if S is not less than Th10 and is smaller than Th11, thevariable-length coding is performed using the table of FIG. 21B; if S isnot less than Th11, the variable-length coding is performed using thetable of FIG. 21C. However, where the macroblock B, macroblock C, ormacroblock D is outside the screen or outside a given slice, or is anintra-coded macroblock, the absolute difference from the motion vectorof that macroblock is treated as a preset value Z10 (Z10≧Th10). Thereason for it is that when the macroblock for generation of the motionvector predicted value is outside the screen or outside the slice, or anintra coded macroblock, it is difficult to make a right predicted valueof motion vector and possible values of the motion vector difference ofthe coding target do not always converge near 0.

Namely, in the variable-length encoder 16 of FIG. 13 a motion vectordifference MVD is first fed as an input symbol H1 into variable-lengthcode output part 30. Then coded symbol memory 31 feeds MV(B), MV(C), andMV(D) as variable-length coding table reference information H3 intovariable-length coding table provider 33. Then variable-length codingtable provider 33 compares the sum S of absolute differences of MV(B),MV(C), and MV(D) with the preset thresholds Th10 and Th11 as describedabove, determines a variable-length coding table to be used for thecoding target motion vector, on the basis thereof, and provides thevariable-length coding table H5 for the variable-length code output part30. Then the coding target motion vector is variable-length coded to beoutputted as coded data D9.

The encoding method in the tenth embodiment of the present invention isconfigured, as described above, so that where the MVD value tends toconverge near 0, the variable-length coding table is switched to onewith short code lengths near 0 to make such a control as to decrease thecode lengths in the case of the MVD value being near 0 and so that wherethe estimation of the MVD value does not always converge near 0, thevariable-length coding table is switched to a table with small deviationof code lengths to prevent the code lengths from becoming long even ifthe MVD value is large; therefore, it is feasible to implement efficientcoding of the MVD value.

The encoding method was described using the three variable-length codingtables in FIGS. 21A-21C, but it is a matter of course that the numberand values of variable-length coding tables are not limited to those inFIGS. 21A-21C. The switching among the tables may also be implemented insuch a way that a plurality of variable-length coding tables areretained in a memory in variable-length coding table provider 33 and theprovision of variable-length coding table H3 is switched among them, orin such a way that the Universal codes such as the exp-Golomb codes asexemplified are used and a parameter thereof is switched to generate thevariable-length coding table H3 in variable-length coding table provider33.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the tenth embodiment of the present invention.When coded data D9 coded by the encoding method in the tenth embodimentof the present invention is fed into decoded symbol output part 40 ofvariable-length decoder 21, decoded symbol memory 41 feeds MV(B), MV(C),and MV(D) calculated from the previously decoded symbols, asvariable-length decoding table reference information H8 intovariable-length decoding table provider 42. Then the variable-lengthdecoding table provider 43 selects a variable-length decoding table H10by procedure similar to the coding and feeds it into decoded symboloutput part 40. Then the decoded symbol output part 40 performs thevariable-length decoding to decode and output a motion vector as adecoded symbol H6, and simultaneously stores it into decoded symbolmemory 41.

Since the variable-length decoder is configured as described above, itis feasible to suitably decode the coded data coded by the encodingmethod in the tenth embodiment of the present invention.

Eleventh Embodiment

Described next is the encoding method according to the eleventhembodiment of the present invention. The encoding method in the fourthembodiment of the present invention was configured not to implement theswitching of the variable-length coding table on the occasion of codingthe nonzero coefficient count CC in the block, whereas the encodingmethod in the eleventh embodiment of the present invention ischaracterized by switching the variable-length coding table withreference to the nonzero coefficient counts in the neighboring blocks onthe occasion of coding the nonzero coefficient count CC.

Namely, since a characteristic of an image at a certain point in thescreen tends to resemble a characteristic of an image in its neighboringareas as described previously, there is a high possibility that thenonzero coefficient count in a certain block is close to those inneighboring blocks. Therefore, where the nonzero coefficient counts inthe neighboring blocks to a coding target block are values close tozero, the nonzero coefficient count CC in the coding target block canalso take a value close to 0 with a high possibility. In this case,therefore, efficient coding can be performed by use of a variable-lengthcoding table with short code lengths near 0. Conversely, where thenonzero coefficient counts in the neighboring blocks take values notclose to 0, the nonzero coefficient count CC in the coding target blockdoes not always converge near 0. In this case, therefore, efficientcoding can be performed by use of such a variable-length coding table asnot to make a large difference in code lengths, regardless of whetherthe value of the nonzero coefficient count CC is large or small.

Keeping these in mind, the eleventh embodiment of the present inventioninvolves preparing a plurality of variable-length coding tables withdifferent characteristics of deviation of distribution of code lengths,for example, as shown in FIGS. 21A-21C, and switching thevariable-length coding table for the nonzero coefficient count CC in thecoding target block, in accordance with an average of values of therespective nonzero coefficient counts in the neighboring blocks to thecoding target block.

Specifically, let CC(B) and CC(C) be the nonzero coefficient counts inblock B adjacent above and block C adjacent left as neighboring blocksto the coding target block A, for example, as shown in FIG. 23. Withrespect to preset thresholds Th12, Th13 (where Th12<Th13), the value ofMC=(CC(B)+CC(C))/2 being an average of nonzero coefficient counts in therespective blocks, is compared with the thresholds, and thevariable-length coding is carried out using as a variable-length codingtable for the nonzero coefficient count CC(A) in the block A, the tableof FIG. 21A if MC is smaller than Th12, the table of FIG. 21B if MC isnot less than Th12 and is smaller than Th13, or the table of FIG. 21C ifMC is not less than Th13. However, where the block B or block C isoutside the screen or outside a given slice, the nonzero coefficientcount of that block is treated as a predetermined value Z11 (Z11≧Th12).The reason for it is that when an adjacent block is outside the screenor outside the slice, or is an intra-coded block, it is difficult topredict possible values of the nonzero coefficient count of the codingtarget, and they do not always converge near 0.

Namely, in the variable-length encoder 16 of FIG. 13 a nonzerocoefficient count CC is first fed as an input symbol H1 intovariable-length code output part 30. Then coded symbol memory 31 feedsCC(B) and CC(C) as variable-length coding table reference information H3into variable-length coding table provider 33. Then variable-lengthcoding table provider 33 compares the average MC Of CC(B) and CC(C) withthe preset thresholds Th12 and Th13 as described above, determines avariable-length coding table to be used for the coding target nonzerocoefficient count, on the basis thereof, and provides thevariable-length coding table H5 for variable-length code output part 30.Then the coding target motion vector is variable-length coded to beoutputted as coded data D9.

The encoding method in the eleventh embodiment of the present inventionis configured, as described above, so that where the nonzero coefficientcount CC tends to converge near 0, the variable-length coding table isswitched to one with short code lengths near 0 to make such a control asto decrease the code lengths in the case of the nonzero coefficientcount CC near 0 and so that where the prediction of the nonzerocoefficient count CC does not always converge near 0, thevariable-length coding table is switched to a table with small deviationof code lengths to prevent the code lengths from becoming long even ifthe nonzero coefficient count CC is large; therefore, it can efficientlyencode the nonzero coefficient count CC.

The encoding method was described using the three variable-length codingtables in FIGS. 21A-21C, but it is a matter of course that the numberand values of variable-length coding tables are not limited to those inFIGS. 21A-21C. The switching among the tables may also be implemented insuch a way that a plurality of variable-length coding tables areretained in a memory in variable-length coding table provider 33 and theprovision of variable-length coding table H3 is switched among thetables, or in such a way that the Universal codes such as the exp-Golombcodes as exemplified are used and a parameter thereof is switched togenerate the variable-length coding table H3 in variable-length codingtable provider 33.

FIG. 14 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the eleventh embodiment of the presentinvention. When coded data D9 coded by the encoding method in theeleventh embodiment of the present invention is fed into decoded symboloutput part 40 of variable-length decoder 21, decoded symbol memory 41feeds CC(B) and CC(C) calculated from the previously decoded symbols, asvariable-length decoding table reference information H8 intovariable-length decoding table provider 42. Then variable-lengthdecoding table provider 43 selects a variable-length decoding table H10by procedure similar to the coding and feeds it into decoded symboloutput part 40. Then decoded symbol output part 40 performs thevariable-length decoding to decode and output a nonzero coefficientcount CC as a decoded symbol H6, and simultaneously stores it intodecoded symbol memory 41.

Twelfth Embodiment

First described with reference to FIGS. 22A-22D is the procedure ofvariable-length coding of orthogonal transform coefficients being imagedata in the encoding method according to the twelfth embodiment of thepresent invention. The description herein is based on the assumptionthat the orthogonal transform to transform spatial image data intofrequency image data is Discrete Cosine Transform (DCT). FIG. 22A showsa specific numerical example of quantized orthogonal transformcoefficients q₁₁-q₈₈ obtained by quantizing the orthogonal transformcoefficients f₁₁-f₈₈ of 8 pixels×8 lines shown in FIG. 4B. Thevariable-length encoder of image encoding apparatus performs thevariable-length coding over such quantized orthogonal transformcoefficients according to a predetermined processing procedure togenerate coded data.

In the case of the quantized orthogonal transform coefficients q₁₁-q₈₈where the subscripts i, j of each coefficient q_(ij) represent avertical frequency and a horizontal frequency corresponding thereto,unlike the image components a₁₁-a₈₈ in the spatial image data (cf. FIG.4A), each quantized orthogonal transform coefficient, concerning themagnitude of the coefficient value thereof or the like, has a datacharacteristic dependent upon the values of the corresponding spacefrequencies. In general, in the case of natural images, large absolutevalues of coefficient values of orthogonal transform are obtained in thelow frequency region and absolute values of coefficient values decreasetoward the high frequency region. This distribution can be approximatedby a Laplace distribution with a peak at zero. As densities of pixels ineach block vary greater, the spread of the distribution of transformcoefficients is also greater and an average amplitude value ofcoefficients increases.

In the processing procedure of the variable-length coding of thequantized orthogonal transform coefficients, first, the quantizedorthogonal transform coefficients q₁₁-q₈₈ being two-dimensional data aretransformed into one-dimensional data, for example, by the zigzag scanshown in FIG. 22B. In this zigzag scan, the quantized orthogonaltransform coefficients are scanned to yield a data string from the lowfrequency region to the high frequency region as the one-dimensionaldata after the scan. This yields the one-dimensional data shown in FIG.22C, in which the quantized orthogonal transform coefficients arealigned from the low frequency region to the high frequency region.

This one-dimensional data of quantized orthogonal transform coefficientsis further transformed into data consisting of values of Level and Runshown in FIG. 22D. Here the Level indicates a coefficient value at aquantized orthogonal transform coefficient with a nonzero coefficientvalue among the plurality of quantized orthogonal transformcoefficients. The Run indicates a zero run length being the number ofdata with the coefficient value of 0 present immediately before anonzero quantized orthogonal transform coefficient.

For example, in the case of the data example of DCT coefficients shownin FIG. 22A, the sixty four DCT coefficients q₁₁-q₈₈ are sorted out,based on locations of appearance of DCT coefficients with nonzerocoefficient value, into a coefficient set S₁ consisting of coefficientq₁₁, a coefficient set S₂ consisting of coefficients q₁₂, q₂₁, acoefficient set S₃ consisting of coefficients q₃₁-q₁₃, a coefficient setS₄ consisting of coefficients q₁₄-q₃₂, a coefficient set S₅ consistingof coefficients q₄₁-q₁₅, and a coefficient set S₆ consisting ofcoefficients q₁₆-q₈₈, as shown in FIG. 22C.

For each of these coefficient sets S_(i) (i=1-6), as shown in FIG. 22D,Level value L_(i) and Run value R_(i) are determined. Specifically, thecoefficient set S₁ has L₁=q₁₁=10 and R₁=0. The coefficient set S₂ hasL₂=q₂₁=−2 and R₂=1. The coefficient set S₃ has L₃=q₁₃=2 and R₃=2. Thecoefficient set S₄ has L₄=q₃₂=−1 and R₄=2. The coefficient set S₅ hasL₅=q₁₅=1 and R₅=5. The last coefficient set S₆ is a coefficient group ofthe coefficients q₁₆-q₈₈ all having the coefficient value of 0, and thushas L₆=0 and R₆ undefined, which is treated as 0 herein for conveniencesake.

Nonzero coefficient count CC and Run total RT in the coding target blockare calculated from the data of Level and Run shown in FIG. 22D. Forexample, specifically, they are calculated as nonzero coefficient countCC=5 and Run total RT=10 from FIG. 22D.

Here, let R_(i) be the Run value of coefficient set S_(i), L_(i) be theLevel value thereof, P_(i) be a frequency location of a nonzerocoefficient after the scan, and L_(i+1) be the Level value of S_(i+1)coded right before. Furthermore, let RT be a Run total in the codingtarget block, CC be the nonzero coefficient count therein, RT_(i) be aRun total residual in coefficient set S_(i), and CC_(i) be a nonzerocoefficient residual count. RT_(i) and CC_(i) are calculated accordingto Eq (1) and Eq (2) below, and P_(i) according to Eq (3). However, thenonzero coefficient residual count for the last coefficient set S_(j) isset as CC_(j)=CC+1, for convenience' sake.RT _(i) =RT _(i+1) −R _(i+1)  Eq (1)CC _(i) =CC _(i+1)−1  Eq (2)P _(i) =RT _(i) +CC _(i)  Eq (3)

FIG. 34B shows an example of a variable-length coding table used on theoccasion of performing the coding of these coefficient sets, and thenonzero coefficient count CC and Run total RT. In this variable-lengthcoding table the left column represents the index values, the centercolumn the variable-length codes corresponding to the index values, andthe right column the code lengths of the respective variable-lengthcodes.

FIG. 13 is an illustration showing the block diagram of variable-lengthencoder 16 according to the twelfth embodiment of the present invention.The nonzero coefficient count CC and Run total RT are first fed as inputsymbols H1 into variable-length code output part 30. Variable-lengthcoding table provider 33 provides a variable-length coding table H5, forexample as shown in FIG. 34B, as a variable-length coding tablecorresponding to the input symbols H1, for variable-length code outputpart 30, and the input symbols H1 are encoded using the variable-lengthcoding table H5. Namely, one is subtracted from the value of the nonzerocoefficient count CC and, using the obtained value as an index value, avariable-length code corresponding thereto is outputted as coded dataD9. Similarly, using the value of Run total RT as an index value, acorresponding variable-length code is outputted as coded data D9.

Then the coefficient sets are encoded in order from thehigh-frequency-side coefficient set. However, a coefficient set with allthe coefficient values of 0 is not encoded. First, when the Run valuesR_(i) of all the coefficient sets are fed as input symbols H1 intovariable-length code output part 30, they are similarly encoded throughthe use of a variable-length coding table, using the Run values R_(i) asindexes, to be outputted as coded data D9.

Then the coding of Level values is carried out for all nonzero Levelvalues in order from the high-frequency-side coefficient set. Asdescribed previously, the orthogonal transform coefficients in DCTdecrease the absolute value of the Level value with increase in thefrequency toward high frequencies, and this distribution can beapproximately by a Laplace distribution with a peak at zero. Therefore,the absolute value of the Level value of a coding target can beanalogized from the absolute value of the Level value encodedimmediately before the coefficient as a coding target. Namely, since thecoding is carried out in order from the high frequency side on thefrequency axis, the coding target Level value is located near the Levelvalue in a coefficient set one higher on the high frequency side on thefrequency axis and thus we can infer that it is highly possible that theabsolute value of the coding target Level value takes a value comparableto the absolute value of the Level value in a coefficient set one higheron the high frequency side. It follows that the coding efficiency can beincreased by generating the context from the absolute value of the Levelvalue in a coefficient set one higher on the high frequency side thanthe coding target Level value, and switching the map table forassociating the index values with the absolute values of the Levelvalues in the variable-length coding table, on the basis of the context.

Here, |L_(i)| be the absolute value of the coding target Level value,sign(L_(i)) be a sign indicating positive or negative, and |L_(i+1)| bethe absolute value of the Level value in the coefficient set S_(i+1) onehigher on the high frequency side. First, coded symbol memory 31 feeds|L_(i+1)| as coding map table reference information H2 into coding maptable provider 32, and, since |L_(i)| is analogized to take a valueclose to |L_(i+1)|, a map table H4 is created so as to relate |L_(i+1)|to an index value for the shortest variable-length code, then relate|L_(i+1)|−1 and |L_(i+1)|+1 to index values for a next shortestvariable-length code, and similarly relate those closer to |L_(i+1)| toindex values for shorter variable-length codes in order.

More specifically, the map table is configured, as shown in FIG. 34A, sothat the index values become smaller toward “0” which is the absolutevalue of the Level value of S₆, for the coefficient set S₅ shown in FIG.22C. Similarly, for the coefficient set S₄, the map table is configured,as shown in FIG. 34A, so that the index values become smaller toward “1”which is the absolute value of the Level value of S₅. For thecoefficient set S₃, a map table is configured, as shown in FIG. 34A, sothat the index values become smaller toward “1” which is the absolutevalue of the Level value of S₄. For the coefficient set S₂, a map tableis configured, as shown in FIG. 35A, so that the index values becomesmaller toward “2” which is the absolute value of the Level value of S₃.For the coefficient set S₁, a map table is configured, as shown in FIG.35A, so that the index values become smaller toward “2” which is theabsolute value of the Level value of S₂.

The map table H4 is generated in this way, the variable-length codeoutput part 30 performs the variable-length coding through the use ofthe variable-length coding table H5, using the absolute values of therespectively corresponding Level values as index values, and, subsequentto the variable-length coding of each symbol, a sign indicating positiveor negative is coded by one bit to designate “0” in the positive case or“1” in the negative case. Namely, when the Level value L_(i) is fed asan input symbol into variable-length code output part 30, coded symbolmemory 31 feeds |L_(i+1)| as coding map table reference information H2into coding map table provider 32 and a corresponding coding map tableH4 is provided for the variable-length code output part 30. At the sametime as it, variable-length coding table provider 33 provides avariable-length coding table H5 for variable-length code output part 30,and the input symbol H1 is variable-length coded to be outputted ascoded data D9.

FIG. 35B shows the result of coding of the Level values in a case wherethe coefficient string in the specific example shown in FIG. 22C issubjected to the coding in the twelfth embodiment of the presentinvention and in a case of conventional coding without switching of themap table.

Since the encoding method in the twelfth embodiment of the presentinvention is configured to implement the variable-length coding withswitching of the map table so as to assign values highly likely toappear as coding target Level values, to short variable-length codeswith reference to the Level value in the neighborhood on the frequencyaxis relative to the coding target coefficient.

The encoding method in the twelfth embodiment of the present inventionwas described so as to perform the coding of the Run values before thatof the Level values, but it is a matter of course that the presentinvention can also be applied to a configuration of coding the Runvalues after the Level values and to a configuration of alternatelycoding the Run values and Level values.

FIG. 36 is an illustration showing a block diagram of variable-lengthdecoder 21 according to the twelfth embodiment of the present invention.When coded data D9 coded by the encoding method in the twelfthembodiment of the present invention is fed into decoded symbol outputpart 40 of variable-length decoder 21, decoded symbol memory 41 feeds apreviously decoded symbol |L_(i+1)| as decoding map table referenceinformation H7 into decoding map table provider 42. Then decoding maptable provider 42 selects a decoding map table H9 by procedure similarto the coding and feeds it into decoded symbol output part 40, andvariable-length decoding table provider 43 feeds a variable-lengthdecoding table H10 into decoded symbol output part 40. Then decodedsymbol output part 40 performs the variable-length decoding to decodeand output the Level value as a decoded symbol H6, and simultaneouslystores it into decoded symbol memory 41.

Since the variable-length decoder is configured as described above, itis feasible to suitably decode the coded data coded by the encodingmethod in the twelfth embodiment of the present invention.

The twelfth embodiment of the present invention was configured to encodethe Level values in order from the highest frequency component of theDCT coefficients, and in that case it is highly possible that absolutevalues of the Level values of high frequency components become “1;”therefore, it is feasible to implement more suitable coding and decodingby adding-numbers of consecutive “1”s from the high frequency side tothe map table of Level values. An example of the map table is presentedin FIG. 36.

Thirteenth Embodiment

In addition to the encoding method in the twelfth embodiment of thepresent invention, the encoding method according to the thirteenthembodiment of the present invention is characterized by switching themap table by use of a Run value in a coding target coefficient set onthe occasion of performing the coding of a Level value. Therefore, theencoding method in the thirteenth embodiment of the present invention isconfigured to encode the Run value in the coding target coefficient set,prior to the coding of the Level value as a coding target. Namely, theencoding method in the thirteenth embodiment of the present invention isconfigured so that in the variable-length encoder 16 shown in FIG. 13,coded symbol memory 31 feeds the Run value as well as the Level value|L_(i+1)| as coding map table reference information H2 into coding maptable provider 32. Specifically, for example, where a Run value islarge, it is considered that a coding target coefficient is located atthe foot of a Laplace distribution and thus an appearing Level valuemust be small. Then, for example, a threshold Th0 is preliminarily setand the control is made so that where the Run value is greater than thethreshold Th0, a map table used for the Level value is one configured todecrease the index values with decreasing Level value. The otheroperation is the same as in the encoding method according to the twelfthembodiment of the present invention.

In the configuration as described above, since it is highly possiblethat the Level value becomes small if the Run value is large theencoding method in the thirteenth embodiment of the present inventioncan encode the small Level value likely to appear where the Run value islarge, by a short code length. Accordingly, the encoding method in thethirteenth embodiment can efficiently encode the Level values.

The decoding method according to the thirteenth embodiment of thepresent invention is implemented by switching the coding map table(decoding map table) by procedure similar to the encoding methodaccording to the thirteenth embodiment of the present invention andperforming processing similar to the decoding method in the twelfthembodiment of the present invention. The decoding method in thethirteenth embodiment of the present invention can suitably decode thecoded data coded by the encoding method in the thirteenth embodiment ofthe present invention.

Fourteenth Embodiment

In addition to the encoding methods in the twelfth and thirteenthembodiments of the present invention, the encoding method according tothe fourteenth embodiment of the present invention is furthercharacterized in that on the occasion of encoding a Level value in acoding target coefficient set, the variable-length coding table isswitched using a frequency location P in the coding target coefficientset. Therefore, the encoding method in the fourteenth embodiment of thepresent invention is configured to, prior to the coding of a Level valueas a coding target, encode a Run value in the coding target coefficientset.

Namely, it is considered, for example, that as the frequency location Pbecomes larger, the coding target coefficient moves toward the foot ofthe Laplace distribution, and thus we can infer that the Level value toappear is probably close to a Level value in a coefficient set onehigher on the high frequency side. It is also considered that as thefrequency location P becomes smaller, the coding target coefficient sitscloser to the top of the Laplace distribution, and, therefore, the Levelvalue to appear must decrease accuracy of analogy from a Level value ina coefficient set one higher on the high frequency side. Thus aplurality of variable-length coding tables are prepared, for example, asshown in FIGS. 21A-21C, and the control is performed so as to adaptivelyswitch among these tables. The plurality of variable-length codingtables presented as an example in FIGS. 21A-21C are called theexp-Golomb codes and are configured as follows. Namely, the codes areconfigured by adding the Binary part of k+j bits to the Unary part ofj+1 bits (j=0, 1, . . . ). Specifically, j is equal to the number of“0”s in the Unary part at a code of interest, and k is equal to the codelength of the zeroth code in the Binary part. FIG. 21A shows theexp-Golomb codes in the case of k=0, FIG. 21B those in the case of k=1,and FIG. 21C those in the case of k=2. As apparent from the figures, thedeviation of distribution of code lengths tends to decrease withincrease in the value of k.

Now, there are prepared a plurality of variable-length coding tableswith different characteristics of deviation of distribution of codelengths in this way, and the variable-length coding table for the codingtarget Level value is switched according to the frequency location P inthe coding target coefficient set. Namely, the control herein is suchthat where the frequency location P is large, the table used is one withlarge deviation of code lengths, as shown in FIG. 21A, and such thatwhere the frequency location is small, the table used is one with smalldeviation of code lengths, as shown in FIG. 21C.

Specifically, for example, thresholds Th1 and Th2 are preliminarily set(where Th1>Th2), and switching is implemented as follows: thevariable-length coding table of FIG. 21A is used where the frequencylocation P_(i) in the coefficient set S_(i) as a coding target is largerthan the threshold Th1; the variable-length coding table of FIG. 21B isused where P_(i) is not more than the threshold Th1 and is larger thanTh2; the variable-length coding table of FIG. 21C is used where P_(i) issmaller than the threshold Th2.

Namely, in the variable-length encoder 16 of FIG. 13, when a Level valueis fed as an input symbol H1 into variable-length code output part 30,coded symbol memory 31 feeds the frequency location P_(i) in the codingtarget coefficient set S_(i) calculated therein, as variable-lengthcoding table reference information H3 into variable-length coding tableprovider 33, and variable-length coding table provider 33 provides avariable-length coding table H5 selected by the aforementioned controltechnique on the basis of the variable-length coding table referenceinformation H3, for the variable-length code output part 30. The otheroperation is much the same as in the twelfth and thirteenth embodimentsof the present invention.

The encoding method in the fourteenth embodiment of the presentinvention is configured to perform such control that in the case wherethe prediction of Level value is likely to be correct, the table used isswitched to one with large deviation of code lengths so as to decreasethe code lengths in the correct prediction case and that in the casewhere the prediction of Level value is unlikely to be correct, the tableused is switched to one with small deviation of code lengths to preventthe code lengths from becoming long in the incorrect prediction case, asdescribed above; therefore, it can efficiently encode the Level values.

The encoding method was described using the three variable-length codingtables in FIGS. 21A-21C, but it is a matter of course that the numberand values of variable-length coding tables are not limited to those inFIGS. 21A-21C. The switching among the tables may also be implemented insuch a way that a plurality of variable-length coding tables areretained in a memory in variable-length coding table provider 32 and theprovision of variable-length coding table H5 is switched among them, orin such a way that the Universal codes such as the exp-Golomb codes asexemplified are used and a parameter thereof is switched to generate thevariable-length coding table H5 in variable-length coding table provider32.

The decoding method according to the fourteenth embodiment of thepresent invention is implemented by switching the coding map table(decoding map table) by procedure similar to the encoding methodaccording to the fourteenth embodiment of the present invention andperforming processing similar to the decoding method in the twelfthembodiment of the present invention. The decoding method in thefourteenth embodiment of the present invention can suitably decode thecoded data coded by the encoding method in the fourteenth embodiment ofthe present invention.

Fifteenth Embodiment

In addition to the encoding methods in the twelfth to fourteenthembodiments of the present invention, the encoding method according tothe fifteenth embodiment of the present invention is furthercharacterized in that on the occasion of encoding a Level value in acoding target coefficient set, the variable-length coding table isswitched using an absolute value of a Level value in a coefficient setone higher on the high frequency side than the coding target coefficientset.

Namely, for example, where the absolute value of the Level value in thecoefficient set one higher on the high frequency side is large, itbecomes more difficult to predict the Level value in the coding targetcoefficient set. Conversely, where the absolute value of the Level valuein the coefficient set one higher on the high frequency side is small,it becomes easier to make a correct prediction for the Level value inthe coding target coefficient set. Just as in the encoding methodaccording to the fourteenth embodiment of the present invention,therefore, the encoding method of the present embodiment involvespreparing a plurality of variable-length coding tables, for example, asshown in FIGS. 21A-21C, and performing such control as to adaptivelyswitch among these. Specifically, for example, thresholds Th3 and Th4are preliminarily set (where Th3<Th4), and switching among thevariable-length coding tables is implemented as follows on the occasionof encoding the Level value L_(i) in the coefficient set S_(i) as acoding target: where the absolute value |L_(i+1)| of the Level value inthe coefficient set S_(i+1) one, higher on the high frequency side issmaller than Th3, the variable-length coding table of FIG. 21A is used;where |L_(i+1)| is not less than Th3 and is smaller than Th4, thevariable-length coding table of FIG. 21B is used; where |L_(i+1)| is notless than Th4, the variable-length coding table of FIG. 21C is used.

Namely, in the variable-length encoder 16 of FIG. 13, when a Level valueis fed as an input symbol H1 into variable-length code output part 30,coded symbol memory 31 feeds |L_(i+1)| as variable-length coding tablereference information H3 into variable-length coding table provider 33,and variable-length coding table provider 33 provides a variable-lengthcoding table H5 selected by the above control technique on the basis ofthe variable-length coding table reference information H3, for thevariable-length code output part 30. The other operation is much thesame as in the twelfth to fourteenth embodiments of the presentinvention.

The encoding method in the fifteenth embodiment of the present inventionis configured to perform such control that in the case where theprediction of Level value is likely to be correct, the table used isswitched to one with large deviation of code lengths so as to decreasethe code lengths in the correct prediction case and that in the casewhere the prediction of Level value is unlikely to be correct, the tableused is switched to one with small deviation of code lengths to preventthe code lengths from becoming long in the incorrect prediction case, asdescribed above; therefore, it can efficiently encode the Level values.

The encoding method in the fifteenth embodiment of the present inventionwas described so as to perform the coding of the Run values before thatof the Level values, but it is a matter of course that the presentinvention can also be applied to a configuration of coding the Runvalues after the Level values and to a configuration of alternatelycoding the Run values and Level values.

The decoding method according to the fifteenth embodiment of the presentinvention is implemented by switching the coding map table (decoding maptable) by procedure similar to the encoding method according to thefifteenth embodiment of the present invention and performing processingsimilar to the decoding method in the twelfth embodiment of the presentinvention. The decoding method in the fifteen embodiment of the presentinvention can suitably decode the coded data coded by the encodingmethod in the fifteen embodiment of the present invention.

Sixteenth Embodiment

The encoding method according to the sixteenth embodiment of the presentinvention is characterized in that on the occasion of encoding a Runvalue in a coding target coefficient set, the variable-length codingtable is switched using the absolute value of the Level value in thecoding target coefficient set. Therefore, the encoding method in thesixteenth embodiment of the present invention is configured to encodethe Level value in the coding target coefficient set, prior to thecoding of the Run value as a coding target.

Namely, if the absolute value of the Level value is large in the codingtarget coefficient set, it is conceivable that the coding targetcoefficient is located at a portion near the top of the Laplacedistribution and frequency components in the neighborhood are alsononzero with a high possibility; therefore, it can be predicted that theRun value is small. Conversely, if the absolute value of the Level valueis small in the coding target set, it is conceivable that the codingtarget coefficient is located at a portion in the foot of the Laplacedistribution, and it is not always highly possible that frequencycomponents in the neighborhood are nonzero; therefore, it becomesdifficult to make a correct prediction for the Run value. Therefore,just as in the encoding method according to the fifteenth embodiment ofthe present invention, the encoding method in the present embodiment isconfigured to prepare a plurality of variable-length coding tables, forexample, as shown in FIGS. 21A-21C and perform such control as toadaptively switch among these. Specifically, for example, thresholds Th5and Th6 are preliminarily set (where Th5>Th6), and switching among thevariable-length coding tables is implemented as follows on the occasionof encoding the Run value R_(i) in the coefficient set S_(i) as a codingtarget: where the absolute value |L_(i)| of the Level value in thecoefficient set S_(i) is larger than Th5, the variable-length codingtable of FIG. 21A is used; where |L_(i)| is not more than Th5 and islarger than Th6, the variable-length coding table of FIG. 21B is used;where |L_(i)| is not more than Th6, the variable-length coding table ofFIG. 21C is used.

Namely, in the variable-length encoder 16 of FIG. 13, when a Run valueis fed as an input symbol H1 into variable-length code output part 30,coded symbol memory 31 feeds |L_(i)| as variable-length coding tablereference information H3 into variable-length coding table provider 33,and variable-length coding table provider 33 provides a variable-lengthcoding table H5 selected by the above control technique on the basis ofthe variable-length coding table reference information H3, forvariable-length code output part 30. The other operation is much thesame as in the twelfth to fifteenth embodiments of the presentinvention.

The encoding method in the sixteenth embodiment of the present inventionis configured to perform such control that where it is easy to make aprediction that the Run value takes a small value, the table used isswitched to one with large deviation of code lengths to decrease thecode lengths in the correct prediction case and that where it isdifficult to make a correct prediction for the Run value, the table usedis switched to one with small deviation of code lengths to prevent thecode lengths from becoming long in the incorrect prediction case, asdescribed above; therefore, it can efficiently encode the Run values.

The decoding method according to the sixteenth embodiment of the presentinvention is implemented by switching the coding map table (decoding maptable) by procedure similar to the encoding method according to thesixteenth embodiment of the present invention and performing processingsimilar to the decoding method in the fifteenth embodiment of thepresent invention. The decoding method in the sixteenth embodiment ofthe present invention can suitably decode the coded data coded by theencoding method in the sixteenth embodiment of the present invention.

Seventeenth Embodiment

Described next is the encoding method according to the seventeenthembodiment of the present invention. The encoding method in the twelfthembodiment of the present invention did not involve switching of thevariable-length coding table on the occasion of encoding the Run totalRT in the block, whereas the encoding method in the seventeenthembodiment of the present invention is characterized in that on theoccasion of encoding the Run total RT in the block, the variable-lengthcoding table is switched according to the motion vector difference DMVfor the coding target block.

The Run total RT in the block can be predicted, for example, from thevalue of nonzero coefficient count CC; the fact that the DCTcoefficients in the block can be approximated by the Laplacedistribution; and so on. The Run total predicted in this way is denotedby PRT. When the motion vector difference DMV, which is a differencebetween a motion vector predicted value predicted from neighboringblocks and a motion vector of a coding target block, is small, it ishighly possible that the DCT coefficients appearing in the coding targetblock can be readily approximated by the Laplace distribution. In thiscase, therefore, efficient coding can be implemented by using as avariable-length coding table for the Run total RT in the block, such avariable-length coding table as to have short code lengths in thevicinity of the predicted value PRT of the Run total. Conversely, wherethe motion vector difference DMV in the coding target block is large, itis highly possible that change in motion and texture is complex in theneighborhood of the coding target block. In this case it is highlypossible that the DCT coefficients cannot be approximated by the Laplacedistribution, and the Run total RT in the coding target block does notalways converge in the vicinity of the predicted value PRT of the Runtotal. In this case, therefore, efficient coding can be implementedusing such a variable-length coding table as not to make a too largedifference among code lengths against any value of Run total RT.

Keeping these in mind, the seventeenth embodiment of the presentinvention involves preparing a plurality of variable-length codingtables with different characteristics of deviation of distribution ofcode lengths, for example, as shown in FIGS. 21A-21C and implementingthe switching of the variable-length coding table for the Run total RTin the coding target block, in accordance with the magnitude of themotion vector difference DMV in the coding target block.

Specifically, for example, the switching of the variable-length codingtable is implemented based on a comparison of the magnitude |DMV| of themotion vector difference DMV in the coding target block with presetthresholds Th7, Th8 (where Th7<Th8). The encoding method is configuredto perform the variable-length coding, using as a variable-length codingtable for the Run total RT in the coding target block, the table of FIG.21A where the value of |DMV| is smaller than Th7, the table of FIG. 21Bwhere |DMV| is not less than Th7 and is smaller than Th8, or the tableof FIG. 21C where |DMV| is not less than Th8.

Namely, in the variable-length encoder 16 of FIG. 13 a Run total RT isfirst fed as an input symbol H1 into variable-length code output part30. Then coded symbol memory 31 feeds |DMV| in the coding target blockas variable-length coding table reference information H3 intovariable-length coding table provider 33. Then variable-length codingtable provider 33 compares |DMV| with the preset thresholds Th7 and Th8as described above, determines a variable-length coding table to be usedfor the Run total RT in the coding target block, on the basis thereof,and provides the variable-length coding table H5 for the variable-lengthcode output part 30. Then the Run total RT is variable-length coded tobe outputted as coded data D9.

The encoding method in the seventeenth embodiment of the presentinvention is configured to perform such control that where the Pun totaltends to converge in the vicinity of the predicted value PRT of the Runtotal, the variable-length coding table is switched to one with shortcode lengths in the vicinity of PRT to control the code lengths short inthe case of the Run total near PRT and that where the Run total does notalways converge in the vicinity of the predicted value PRT of the Runtotal, the table is switched to one with small deviation of code lengthsto prevent the code lengths from becoming long whatever value the Runtotal RT takes; therefore, it can efficiently encode the Run total RT.

FIG. 36 is an illustration showing the block diagram of variable-lengthdecoder 21 according to the seventeenth embodiment of the presentinvention. When coded data D9 coded by the encoding method in theseventeenth embodiment of the present invention is fed into decodedsymbol output part 40 of variable-length decoder 21, decoded symbolmemory 41 feeds |DMV| calculated from the previously decoded symbols, asvariable-length decoding table reference information H8 intovariable-length decoding table provider 43. Then variable-lengthdecoding table provider 43 selects a variable-length decoding table H10by procedure similar to the coding and feeds it into decoded symboloutput part 40. Then the decoded symbol output part 40 performs thevariable-length decoding to decode and output the Run total RT as adecoded symbol H6.

The above embodiments were described using the encoding apparatus anddecoding apparatus, but it should be noted that these can be implementedby hardware or by software. It is also noted that they were describedusing the specific variable-length coding tables and image encodingsystems for easier understanding of the description and that the presentinvention is by no means intended to be limited to these.

As described in the above embodiments, a variety of modificationexamples can be readily contemplated for the switching methods of thecoding table and map table using the coding condition or imagecharacteristics, and the present invention can be applied to all ofthem.

The above embodiments were described using an example of moving-picturecoding, but the present invention does not have to be limited to thisand can be applied to any moving-picture encoding system and still-imageencoding system as long as they allow application of the target codingsymbol and utilized context.

The image encoding methods and image decoding methods in the aboveembodiments can be preferably applied to the image transmission system,image storage system, and image reproduction system shown in FIGS. 29A,29B, and 29C, whereby it becomes feasible to effectively utilize suchresources as the transmission band, storage capacity, and so on.

The above embodiments were described using the three variable-lengthcoding tables of FIGS. 21A-21C, but the number and values ofvariable-length coding tables are not limited to those in FIGS. 21A-21C,of course. For example, the tables may be variable-length coding tableswith different code length distributions generated by changing anotherparameter of the exp-Golomb codes as shown in FIGS. 37A-37C.

The encoding methods and decoding methods in the above embodiments weredescribed using the specific table values, but it is needless to mentionthat the present invention is not limited to these values. In the aboveembodiments, the methods were described using the example of the DCTcoefficients of 8 pixels×8 lines, but it is needless to mention that thetype of the orthogonal transform and the size of blocks are not limitedto these.

In the above embodiments the Run values are handled in order from thoseof high frequency components, but it is a matter of course that likeeffect can also be achieved by processing from the low frequencycomponents. In addition, much preferred coding/decoding can beimplemented, for example, by a configuration of switching the order ofprocessing of the Run values to the other according to the value ofnonzero coefficient count CC in the processing target block. Namely, forexample, with respect to a preset threshold ThC, the Run values arehandled from the low frequency components where the nonzero coefficientcount CC is smaller than ThC, but from the high frequency componentswhere the nonzero coefficient count CC is equal to or larger than theabove threshold ThC, which increases the possibility of assigningsmaller values to the Run values, so as to enable much preferred codingand decoding.

The encoding methods and decoding methods in the above embodiments weredescribed each as separate embodiments, but it is needless to mentionthat like effect can also be achieved when a plurality of methods amongthem are simultaneously used.

The encoding methods and decoding methods in the above embodiments weredescribed as those to encode or decode the Run values and Level valuesin series by use of the one-dimensional variable-length coding tables,but it is needless to mention that like effect can also be attained by aconfiguration to encode or decode them in parallel (in combination ofRun values and Level values) by use, of a two-dimensionalvariable-length coding table. In the two-dimensional variable-lengthtable utilizing the correlation between Run and Level, however, a changeof index values based on the switching of the map table will result indegrading the correlation between Run and Level and thus decreasing thecoding efficiency, and, therefore, more efficient coding can beperformed by use of the one-dimensional variable-length coding tabledescribed in the embodiments of the present invention.

In the embodiments the coding was described using the variable-lengthcoding to switch among the variable-length coding tables, but likeeffect can also be attained by using arithmetic coding to perform suchprocessing, of course. When the arithmetic coding is applied, theembodiments can be modified as follows with like effect: a probabilitytable with large symbol occurrence probabilities in arithmetic coding isused for a coding target symbol assigned a short code length, and aprobability table with small symbol occurrence probabilities inarithmetic coding is used for a coding target symbol assigned a longcode length.

Furthermore, like effect can be achieved by using a probability tablewith large deviation of symbol occurrence probabilities corresponding torespective symbols in arithmetic coding, in place of the variable-lengthcoding table with large deviation of code lengths used in theembodiments, and by using a probability table with small deviation ofsymbol occurrence probabilities corresponding to respective symbols inarithmetic coding, in place of the variable-length coding table withsmall deviation of code lengths. Specifically, similar effect can beattained by using the probability tables of FIGS. 38A-38C, for example,in place of the variable-length coding tables of FIGS. 21A-21C. Theother operations are much the same as in those in the embodimentsdescribed above, and thus the details thereof are omitted herein.

A computer program can provide each of the functions of the followingcomponents in each of the above embodiments: motion detector 11, motioncompensator 12, orthogonal transformer 14, quantizer 15, variable-lengthencoder 16, dequantizer 17, inverse orthogonal transformer 18,variable-length decoder 21, dequantizer 22, inverse orthogonaltransformer 23, motion compensator 24, coding map table provider 32,variable-length coding table provider 33, variable-length code outputpart 30, decoded symbol output part 40, decoding map table provider 42,variable-length decoding table provider 43, learning function-addedcoding map table provider 52, feedback function-added variable-lengthcode output part 51, learning function-added coding/decoding map tableprovider 62, and feedback function-added decoded symbol output part 61.Furthermore, this computer program can be transmitted on a carrier wave.

INDUSTRIAL APPLICABILITY

the present invention is applicable as image encoding apparatus, imagedecoding apparatus, image encoding methods, image decoding methods,image encoding programs, and image decoding programs.

1. An image decoding apparatus comprising a decoding part for decodingcoded data obtained by dividing a coding target image into macroblocksof a predetermined size, dividing each said macroblock into blocks of apredetermined shape and size specified based on a macroblock type,performing a motion compensated prediction in each unit of said block tooutput a motion vector, generating a predicted image from a referenceimage on the basis of the motion vector, calculating a differencebetween the predicted image and the coding target image to output apredictive image, performing transform coding of the predictive residualimage in each unit of a predetermined transform block to outputtransform coefficients, quantizing the transform coefficients on thebasis of a quantization parameter to output quantized transformcoefficients, and performing compression coding of coding-relatedinformation containing the motion vector, the quantized transformcoefficients, the macroblock type, and the quantization parameter toyield coded data, wherein the decoding part comprises a decoded symbolmemory for memorizing the coding-related information previously decoded;a decoding procedure provider for providing one or more types ofdecoding procedures; and a decoded data outputting part for selecting adecoding procedure which is one of the decoding procedures provided bythe decoding procedure provider and which corresponds to a codingprocedure used in the coding of the coding-related information as adecoding target, based on a predetermined decoding procedure selectioncriterion, using the coding-related information previously decoded andstored in the decoded symbol memory, and for decoding the coding-relatedinformation on the basis of the selected decoding procedure to outputdecoded data, and the decoding part has a function of, for each of thetransform blocks in a said macroblock, decoding coded block patterninformation containing a nonzero coefficient existence flag indicatingwhether there exists a nonzero, said quantized transform coefficient,wherein, on the occasion of decoding the coded block pattern informationin the coding target macroblock, the decoding procedure providerprovides a decoding procedure corresponding to a coding procedureprovided so as to decrease a code length based on a predetermineddecoding procedure selection criteria, and in the case a size of thequantization parameter in the coding target macroblock is larger than apreset threshold, the decoding procedure provider provides a decodingprocedure so as to set a shorter code length for the coded block patterninformation indicating a smaller number of blocks including a nonzeroquantized transform coefficient.
 2. The image decoding apparatusaccording to claim 1, wherein, where a macroblock type in a neighboringmacroblock to the coding target macroblock is one indicating division ofthe coding target macroblock into a maximum number of blocks, thedecoding procedure provider assumes that all the coding blocks in thecoding target macroblock have the coded block pattern informationindicating inclusion of a nonzero quantized transform coefficient, and,on the occasion of decoding the coded block pattern information in thecoding target macroblock, the decoding procedure provider provides adecoding procedure corresponding to a coding procedure provided so as todecrease a code length as a spatial correlation of the coded blockpattern information becomes higher between the coding target macroblockand the neighboring macroblock thereto.
 3. An image decoding apparatuscomprising a decoding part for decoding coded data obtained by dividinga coding target image into macroblocks of a predetermined size, dividingeach said macroblock into blocks of a predetermined shape and sizespecified based on a macroblock type, performing a motion compensatedprediction in each unit of said block to output a motion vector,generating a predicted image from a reference image on the basis of themotion vector, calculating a difference between the predicted image andthe coding target image to output a predictive image, performingtransform coding of the predictive residual image in each unit of apredetermined transform block to output transform coefficients,quantizing the transform coefficients on the basis of a quantizationparameter to output quantized transform coefficients, and performingcompression coding of coding-related information containing the motionvector, the quantized transform coefficients, the macroblock type, andthe quantization parameter to yield coded data, wherein the decodingpart comprises a decoded symbol memory for memorizing the coding-relatedinformation previously decoded; a decoding procedure provider forproviding one or more types of decoding procedures; and a decoded dataoutputting part for selecting a decoding procedure which is one of thedecoding procedures provided by the decoding procedure provider andwhich corresponds to a coding procedure used in the coding of thecoding-related information as a decoding target, based on apredetermined decoding procedure selection criterion, using thecoding-related information previously decoded and stored in the decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure to output decoded data,wherein, the decoding part has a function of decoding a number of saidnonzero quantized transform coefficients in the block, and wherein, onthe occasion of decoding the number of said nonzero quantized transformcoefficients in the coding target macroblock, where the number of saidnonzero quantized transform coefficients in a neighboring block to thecoding target block is smaller than a preset threshold, the decodingprocedure provider provides a decoding procedure corresponding to acoding procedure provided so as to decrease a code length with decreasein the number of said nonzero quantized transform coefficients.
 4. Theimage decoding apparatus according to claim 1, wherein the decodedsymbol memory has a function of holding a difference motion vector valuebeing a difference between a predicted motion vector predicted from aneighboring block, and an actual motion vector, wherein, on the occasionof decoding the coded block pattern information in the coding targetmacroblock, where a magnitude of the difference motion vector value in aneighboring macroblock to the coding target macroblock is larger than apreset threshold, the decoding procedure provider provides a decodingprocedure corresponding to a coding procedure provided so as to set ashorter code length for coded block pattern information indicating alarger number of blocks containing a nonzero quantized transformcoefficient.
 5. An image decoding apparatus comprising a decoding partfor decoding coded data obtained by dividing a coding target image intomacroblocks of a predetermined size, dividing each said macroblock intoblocks of a predetermined shape and size specified based on a macroblocktype, performing a motion compensated prediction in each unit of saidblock to output a motion vector, generating a predicted image from areference image on the basis of the motion vector, calculating adifference between the predicted image and the coding target image tooutput a predictive image, performing transform coding of the predictiveresidual image in each unit of a predetermined transform block to outputtransform coefficients, quantizing the transform coefficients on thebasis of a quantization parameter to output quantized transformcoefficients, and performing compression coding of coding-relatedinformation containing the motion vector, the quantized transformcoefficients, the macroblock type, and the quantization parameter toyield coded data, wherein the decoding part comprises a decoded symbolmemory for memorizing the coding-related information previously decoded;a decoding procedure provider for providing one or more types ofdecoding procedures; and a decoded data outputting part for selecting adecoding procedure which is one of the decoding procedures provided bythe decoding procedure provider and which corresponds to a codingprocedure used in the coding of the coding-related information as adecoding target, based on a predetermined decoding procedure selectioncriterion, using the coding-related information previously decoded andstored in the decoded symbol memory, and for decoding the coding-relatedinformation on the basis of the selected decoding procedure to outputdecoded data, wherein the decoded symbol memory has a function ofholding a difference motion vector value being a difference between apredicted motion vector predicted from a neighboring block, and anactual motion vector, and wherein, on the occasion of decoding thedifference motion vector value in the coding target macroblock, where amagnitude of the difference motion vector value in a neighboring blockto the coding target block is smaller than a preset threshold, thedecoding procedure provider provides a decoding procedure correspondingto a coding procedure provided so as to set a shorter code lengthsmaller difference motion vector value.
 6. An image decoding apparatuscomprising: a decoding part for decoding coded data obtained by dividinga coding target image or a predictive residual image generated based onthe coding target image, into predetermined transform blocks, performingtransform coding of the coding target image or the predictive residualimage in each unit of said transform block to output transformcoefficients, quantizing the output transform coefficients on the basisof a quantization parameter to output quantized transform coefficients,and performing compression coding of coding-related informationcontaining the quantized transform coefficients and the quantizationparameter to yield coded data, wherein the decoding part has a functionof converting the quantized transform coefficients in the coding targetblock to a one-dimensional string according to frequencies and decodinga zero run value being a number of consecutive coefficients providing 0as an absolute value of the quantized transform coefficients in theone-dimensional string, a level value being an absolute value of a saidquantized transform coefficient, and a positive/negative sign indicatingwhether the quantized transform coefficient is positive or negative, andcomprises a decoded symbol memory for memorizing the coding-relatedinformation previously decoded; a decoding procedure provider forproviding one or more types of decoding procedures; and a decoded dataoutputting part for selecting a decoding procedure which is one of thedecoding procedures provided by the decoding procedure provider andwhich corresponds to a coding procedure used in the coding of thecoding-related information as a decoding target, based on apredetermined coding procedure selection criterion, using thecoding-related information previously decoded and stored in the decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure to output decoded data, and, onthe occasion of decoding the level value, where a zero run value at afrequency near the coding target level value is larger than a presetthreshold, the decoding procedure provider provides a decoding procedurecorresponding to a coding procedure provided so as to decrease a codelength as the level value becomes smaller.
 7. An image decodingapparatus comprising: a decoding part for decoding coded data obtainedby dividing a coding target image or a predictive residual imagegenerated based on the coding target image, into predetermined transformblocks, performing transform coding of the coding target image or thepredictive residual image in each unit of said transform block to outputtransform coefficients, quantizing the output transform coefficients onthe basis of a quantization parameter to output quantized transformcoefficients, and performing compression coding of coding-relatedinformation containing the quantized transform coefficients and thequantization parameter to yield coded data, wherein the decoding parthas a function of converting the quantized transform coefficients in thecoding target block to a one-dimensional string according to frequenciesand decoding a zero run value being a number of consecutive coefficientsproviding 0 as an absolute value of the quantized transform coefficientsin the one-dimensional string, a level value being an absolute value ofa said quantized transform coefficient, and a positive/negative signindicating whether the quantized transform coefficient is positive ornegative, and comprises a decoded symbol memory for memorizing thecoding-related information previously decoded; a decoding procedureprovider for providing one or more types of decoding procedures; and adecoded data outputting part for selecting a decoding procedure which isone of the decoding procedures provided by the decoding procedureprovider and which corresponds to a coding procedure used in the codingof the coding-related information as a decoding target, based on apredetermined coding procedure selection criterion, using thecoding-related information previously decoded and stored in the decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure to output decoded data, andwherein the decoding part has a function of decoding a number of nonzeroquantized transform coefficients in the coding target block, wherein,where the number of nonzero quantized coefficients in the coding targetblock is smaller than a preset threshold, the decoding part decodes thelevel values and the zero run values thereof in order from a lowestfrequency component, and wherein, where the number of nonzero quantizedcoefficients in the coding target block is larger than the presetthreshold, the decoding part decodes the level values and the zero runvalues thereof in order from a highest frequency component.
 8. An imagedecoding method comprising a decoding step of decoding coded dataobtained by dividing a coding target image into macroblocks of apredetermined size, dividing each said macroblock into blocks of apredetermined shape and size specified based on a macroblock type,performing a motion compensated prediction in each unit of said block tooutput a motion vector, generating a predicted image from a referenceimage on the basis of the motion vector, calculating a differencebetween the predicted image and the coding target image to output apredictive image, performing transform coding of the predictive residualimage in each unit of a predetermined transform block to outputtransform coefficients, quantizing the transform coefficients on thebasis of a quantization parameter to output quantized transformcoefficients, and performing compression coding of coding-relatedinformation containing the motion vector, the quantized transformcoefficients, the macroblock type, and the quantization parameter toyield coded data, wherein the decoding step is to prepare one or moretypes of decoding procedures, select a decoding procedure which is oneof said one or more types of decoding procedures and which correspondsto a coding procedure used in the coding of the coding-relatedinformation as a decoding target, based on a predetermined decodingprocedure selection criterion, using the coding-related informationpreviously decoded and stored in a decoded symbol memory, and decode thecoding-related information on the basis of the selected decodingprocedure that decreases code length to output decoded data, and in thecase a size of the quantization parameter in the coding targetmacroblock is larger than a preset threshold, the decoding step providesa decoding procedure so as to set a shorter code length for the codedblock pattern information indicating a smaller number of blocksincluding a nonzero quantized transform coefficient.
 9. An imagedecoding method comprising: a decoding step of decoding coded dataobtained by dividing a coding target image or a predictive residualimage generated based on the coding target image, into predeterminedtransform blocks, performing transform coding of the coding target imageor the predictive residual image in each unit of said transform block tooutput transform coefficients, quantizing the output transformcoefficients on the basis of a quantization parameter to outputquantized transform coefficients, and performing compression coding ofcoding-related information containing the quantized transformcoefficients and the quantization parameter to yield coded data, whereinthe decoding step is a step of converting the quantized transformcoefficients in the coding target block to a one-dimensional stringaccording to frequencies and decoding a zero run value being a number ofconsecutive coefficients providing 0 as an absolute value of thequantized transform coefficients in the one-dimensional string, a levelvalue being an absolute value of the quantized transform coefficients,and a positive/negative code indicating whether the quantized transformcoefficient is positive or negative, and is to prepare one or more typesof decoding procedures, select a decoding procedure which is one of theone or more types of decoding procedures and which corresponds to acoding procedure used in the coding of the coding-related information asa decoding target, based on a predetermined coding procedure selectioncriterion, using the coding-related information previously decoded andstored in a decoded symbol memory, and decode the coding-relatedinformation on the basis of the selected decoding procedure thatdecreases a code length to output decoded data.
 10. A computer readablemedium storing an image decoding program for controlling a computer tofunction as: decoding means for decoding coded data obtained by dividinga coding target image into macroblocks of a predetermined size, dividingeach said macroblock into blocks of a predetermined shape and sizespecified based on a macroblock type, performing a motion compensatedprediction in each unit of said block to output a motion vector,generating a predicted image from a reference image on the basis of themotion vector, calculating a difference between the predicted image andthe coding target image to output a predictive image, performingtransform coding of the predictive residual image in each unit of apredetermined transform block to output transform coefficients,quantizing the transform coefficients on the basis of a quantizationparameter to output quantized transform coefficients, and performingcompression coding of coding-related information containing the motionvector, the quantized transform coefficients, the macroblock type, andthe quantization parameter to yield coded data, wherein the decodingmeans comprises a decoding procedure providing means for providing oneor more types of decoding procedures; and decoded data outputting meansfor selecting a decoding procedure which is one of the decodingprocedures provided by the decoding procedure providing means and whichcorresponds to a coding procedure used in the coding of thecoding-related information as a decoding target, based on apredetermined decoding procedure selection criterion, using thecoding-related information previously decoded and stored in a decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure that decreases a code length tooutput decoded data, and in the case a size of the quantizationparameter in the coding target macroblock is larger than a presetthreshold, the decoding procedure providing means provides a decodingprocedure so as to set a shorter code length for the coded block patterninformation indicating a smaller number of blocks including a nonzeroquantized transform coefficient.
 11. A computer readable medium storingan image decoding program for controlling a computer to function as:decoding means for decoding coded data obtained by dividing a codingtarget image or a predictive residual image generated based on thecoding target image, into predetermined transform blocks, performingtransform coding of the coding target image or the predictive residualimage in each unit of said transform block to output transformcoefficients, quantizing the output transform coefficients on the basisof a quantization parameter to output quantized transform coefficients,and performing compression coding of coding-related informationcontaining the quantized transform coefficients and the quantizationparameter to yield coded data, wherein the decoding means comprisesmeans for converting the quantized transform coefficients in the codingtarget block to a one-dimensional string according to frequencies anddecoding a zero run value being a number of consecutive coefficientsproviding 0 as an absolute value of the quantized transform coefficientsin the one-dimensional string, a level value being an absolute value ofa said quantized transform coefficient, and a positive/negative signindicating whether the quantized transform coefficient is positive ornegative, and further comprises decoding procedure providing means forproviding one or more types of decoding procedures; and decoded dataoutputting means for selecting a decoding procedure which is one of thedecoding procedures provided by the decoding procedure providing meansand which corresponds to a coding procedure used in the coding of thecoding-related information as a decoding target, based on apredetermined coding procedure selection criterion, using thecoding-related information previously decoded and stored in a decodedsymbol memory, and for decoding the coding-related information on thebasis of the selected decoding procedure that decreases a code length tooutput decoded data.